go/build - how to locate source without making network calls?

45 views
Skip to first unread message

James Lawrence

unread,
Jul 2, 2020, 7:55:55 PM7/2/20
to golang-nuts

I've been playing with the go/build package for resolving go package information for a few projects of mine and noticed some unexpected behavior.

mainly it seems to reach out to the network even when all the information is available locally. if I turn off my network my code fails whereas go install seems to continue to function normally even without a network.

is there a better way to resolve go packages locally than `build.Import(...)`?

importer looks promising but it seems that it is currently impossible to provide a build.Context to an importer because the srcimporter is inside an internal package.



Reply all
Reply to author
Forward
0 new messages