Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Cache imported packages #55

Closed

Conversation

charlievieth
Copy link

This commit adds a types.Importer that caches packages. The uses the filepath of the object/archive file associated with a package as the key so that vendoring is supported (it also makes the cache relatively simple). The timestamp of the object/archive file is used to determine when a package should be re-imported.

Note: There is already an open PR to add caching (#51), but being that I've already written this and that it's a little more portable (since it implements a types.ImporterFrom that may be used by gbimporter instead of modifying gbimporter itself) I'm creating the PR. Happy to close, if the solution proposed in #51 is preferable.

This commit adds a types.Importer that caches packages.  The uses the
filepath of the object/archive file associated with a package as the key
so that vendoring is supported (it also makes the cache relatively simple).
The timestamp of the object/archive file is used to determine when a
package should be re-imported.
@charlievieth
Copy link
Author

charlievieth commented Sep 9, 2018

Tests pass on go1.10.3 and go1.11.0 on Darwin and Linux. The tests fail on the latest development version of Go:

go version devel +4545fea4fc Sat Sep 8 23:59:26 2018 +0000 linux/amd64

The reason for the failure is that func MapRange() *reflect.MapIter is now included in the result set, which is correct. The MapRange method was added with commit golang/go@ede5958 which exists on master, but is not in the go1.11.x or go1.10.x release branches.

If MapRange is included in the next release of Go the tests will need to be updated.

@charlievieth
Copy link
Author

bump

@stamblerre
Copy link
Collaborator

There is already a branch that adds caching, and I think it's pretty similar to what you have here. I can investigate merging the branch into master, but I don't think we will accept this since it's too similar. Sorry about that!

@stamblerre stamblerre closed this Oct 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants