main: refactor environment variables into a separate package

This makes it possible to query these environment variables from
anywhere, which might be useful. More importantly, it puts them in a
central location from where they can be queried, useful for a `go env`
subcommand.
This commit is contained in:
Ayke van Laethem
2019-10-14 15:51:03 +02:00
committed by Ron Evans
parent 2a71aa90bc
commit 2463153a8c
7 changed files with 214 additions and 173 deletions
+3 -1
View File
@@ -8,6 +8,8 @@ package main
import (
"os"
"os/exec"
"github.com/tinygo-org/tinygo/goenv"
)
// Link invokes a linker with the given name and arguments.
@@ -20,6 +22,6 @@ func Link(linker string, flags ...string) error {
cmd := exec.Command(linker, flags...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = sourceDir()
cmd.Dir = goenv.Get("TINYGOROOT")
return cmd.Run()
}