fix: us build default

This commit is contained in:
Kevin Franklin Kim 2025-03-18 07:43:31 +01:00
parent a332d9564f
commit e65c0a168e
No known key found for this signature in database
2 changed files with 4 additions and 14 deletions

View File

@ -62,7 +62,7 @@ func getPathForTarget(gomod config.Namespace, goPath string, target *config.Targ
}
}
func Build(conf *config.Config, goRoot, goPath string) { //nolint:maintidx
func Build(conf *config.Config, goPath string, goSources []string) { //nolint:maintidx
deriveCommonJSMapping(conf)
mappedTypeScript := map[string]map[string]*code{}
@ -119,7 +119,7 @@ func Build(conf *config.Config, goRoot, goPath string) { //nolint:maintidx
}
vendorDirectory := path.Join(workDirectory, "vendor")
goPaths := []string{goPath, goRoot}
goPaths := append(goSources, goPath)
if _, err := os.Stat(vendorDirectory); !os.IsNotExist(err) {
goPaths = append(goPaths, vendorDirectory)

View File

@ -35,21 +35,11 @@ func main() {
}
gotsrpc.ReaderTrace = *flagDebug
// check if GOPATH has been set as env variable
// if not use the default from the build pkg
goPath := os.Getenv("GOPATH")
if goPath == "" {
goPath = build.Default.GOPATH
}
goRoot := os.Getenv("GOROOT")
if goPath == "" {
goPath = build.Default.GOROOT
}
conf, err := config.LoadConfigFile(args[0])
if err != nil {
fmt.Fprintln(os.Stderr, "config load error, could not load config from", args[0], ":", err)
os.Exit(2)
}
gotsrpc.Build(conf, goRoot, goPath)
gotsrpc.Build(conf, build.Default.GOPATH, build.Default.SrcDirs())
}