We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04ce7ba commit e2752bcCopy full SHA for e2752bc
testutils/pkg.go
@@ -31,8 +31,14 @@ type TestPackage struct {
31
// NewTestPackage will create a new and empty package. Must call Close() to cleanup
32
// auxiliary files
33
func NewTestPackage() *TestPackage {
34
+ goPath := os.Getenv("GOPATH")
35
+ // if user did not set GOPATH, set to the default
36
+ if goPath == "" {
37
+ goPath = build.Default.GOPATH
38
+ }
39
+
40
// Files must exist in $GOPATH
- sourceDir := path.Join(os.Getenv("GOPATH"), "src")
41
+ sourceDir := path.Join(goPath, "src")
42
workingDir, err := ioutil.TempDir(sourceDir, "gosecs_test")
43
if err != nil {
44
return nil
0 commit comments