mirror of https://github.com/go-python/gopy.git
replace deprecated package compilation mode, add NeedsDeps
This commit is contained in:
parent
2725838e76
commit
712090b747
5
gen.go
5
gen.go
|
@ -98,7 +98,7 @@ func loadPackage(path string, buildFirst bool, buildTags string) (*packages.Pack
|
||||||
args = append(args, "-tags", buildTagStr)
|
args = append(args, "-tags", buildTagStr)
|
||||||
}
|
}
|
||||||
args = append(args, "-v", path)
|
args = append(args, "-v", path)
|
||||||
fmt.Printf("go %v\n", strings.Join(args, " "))
|
fmt.Printf("go %s\n", strings.Join(args, " "))
|
||||||
cmd := exec.Command("go", args...)
|
cmd := exec.Command("go", args...)
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
|
@ -115,7 +115,8 @@ func loadPackage(path string, buildFirst bool, buildTags string) (*packages.Pack
|
||||||
}
|
}
|
||||||
|
|
||||||
// golang.org/x/tools/go/packages supports modules or GOPATH etc
|
// golang.org/x/tools/go/packages supports modules or GOPATH etc
|
||||||
bpkgs, err := packages.Load(&packages.Config{Mode: packages.LoadTypes}, path)
|
mode := packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedDeps | packages.NeedImports | packages.NeedTypes | packages.NeedTypesSizes
|
||||||
|
bpkgs, err := packages.Load(&packages.Config{Mode: mode}, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error resolving import path [%s]: %v\n",
|
log.Printf("error resolving import path [%s]: %v\n",
|
||||||
path,
|
path,
|
||||||
|
|
Loading…
Reference in New Issue