Make the external test work on more environments
GOPATH is actually a list of path and doesn't necessarily have to be set. If unset it will default to $GOPATH/go in go 1.9+. Assume that go install will install to the first path in the list.
This commit is contained in:
parent
77d1709c32
commit
6ed873b72d
|
@ -5,6 +5,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
|
@ -117,8 +118,13 @@ func buildDataSourceTestProgram() (string, error) {
|
|||
return "", fmt.Errorf("failed to build test stub program: %s", err)
|
||||
}
|
||||
|
||||
gopath := os.Getenv("GOPATH")
|
||||
if gopath == "" {
|
||||
gopath = filepath.Join(os.Getenv("HOME") + "/go")
|
||||
}
|
||||
|
||||
programPath := path.Join(
|
||||
os.Getenv("GOPATH"), "bin", "tf-acc-external-data-source",
|
||||
filepath.SplitList(gopath)[0], "bin", "tf-acc-external-data-source",
|
||||
)
|
||||
return programPath, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue