main: use GOPATH from the environment

Be more compatible with the Go toolchain by setting GOPATH in the same
way. This makes it possible to flash and run examples from the standard
GOPATH instead of only from the source tree.
This commit is contained in:
Ayke van Laethem
2018-09-29 22:30:45 +02:00
parent 5bf058a0a6
commit b6db84e916
3 changed files with 34 additions and 1 deletions
+2
View File
@@ -22,6 +22,7 @@ func Compile(pkgName, outpath string, spec *TargetSpec, printIR, dumpSSA, debug
Debug: debug,
DumpSSA: dumpSSA,
RootDir: sourceDir(),
GOPATH: getGopath(),
BuildTags: spec.BuildTags,
}
c, err := compiler.NewCompiler(pkgName, config)
@@ -198,6 +199,7 @@ func Flash(pkgName, target, port string, printIR, dumpSSA, debug bool, printSize
func Run(pkgName string) error {
config := compiler.Config{
RootDir: sourceDir(),
GOPATH: getGopath(),
}
c, err := compiler.NewCompiler(pkgName, config)
if err != nil {