mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
fix: pass goroot
This commit is contained in:
parent
5debe54950
commit
a332d9564f
5
build.go
5
build.go
@ -7,7 +7,6 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@ -63,7 +62,7 @@ func getPathForTarget(gomod config.Namespace, goPath string, target *config.Targ
|
||||
}
|
||||
}
|
||||
|
||||
func Build(conf *config.Config, goPath string) { //nolint:maintidx
|
||||
func Build(conf *config.Config, goRoot, goPath string) { //nolint:maintidx
|
||||
deriveCommonJSMapping(conf)
|
||||
|
||||
mappedTypeScript := map[string]map[string]*code{}
|
||||
@ -120,7 +119,7 @@ func Build(conf *config.Config, goPath string) { //nolint:maintidx
|
||||
}
|
||||
vendorDirectory := path.Join(workDirectory, "vendor")
|
||||
|
||||
goPaths := []string{goPath, runtime.GOROOT()}
|
||||
goPaths := []string{goPath, goRoot}
|
||||
|
||||
if _, err := os.Stat(vendorDirectory); !os.IsNotExist(err) {
|
||||
goPaths = append(goPaths, vendorDirectory)
|
||||
|
||||
@ -37,7 +37,11 @@ func main() {
|
||||
|
||||
// check if GOPATH has been set as env variable
|
||||
// if not use the default from the build pkg
|
||||
goPath := os.Getenv("GOROOT")
|
||||
goPath := os.Getenv("GOPATH")
|
||||
if goPath == "" {
|
||||
goPath = build.Default.GOPATH
|
||||
}
|
||||
goRoot := os.Getenv("GOROOT")
|
||||
if goPath == "" {
|
||||
goPath = build.Default.GOROOT
|
||||
}
|
||||
@ -47,5 +51,5 @@ func main() {
|
||||
fmt.Fprintln(os.Stderr, "config load error, could not load config from", args[0], ":", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
gotsrpc.Build(conf, goPath)
|
||||
gotsrpc.Build(conf, goRoot, goPath)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user