You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m writing a unit test where I construct a custom GOPATH for each test case. I use types.Config{Importer: importer.For("source", nil)}, but see no way to pass my per-test custom GOPATH to that importer: importer.For calls srcimporter.New as follows:
Specialized lookup should be supported via the lookup interface - which is currently not supported. It's a known issue. I'm going to close this as a duplicate of #13847, fixing that issue will enable this request as well. The problem is that we may have to change the API (again), and that means adding yet another entry point because we cannot change what's here due to the Go 1.0 guarantee.
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
I’m writing a unit test where I construct a custom GOPATH for each test case. I use
types.Config{Importer: importer.For("source", nil)}
, but see no way to pass my per-test custom GOPATH to that importer:importer.For
callssrcimporter.New
as follows:As
srcimporter
is internal, callingimporter.For
is the only way of obtaining one.My current workaround is to overwrite
build.Default
, but that precludes my unit tests from running in parallel.Could we add a way to obtain a source importer which allows passing in a
build.Context
?cc @griesemer
The text was updated successfully, but these errors were encountered: