Skip to content

Commit 712090b

Browse files
committed
replace deprecated package compilation mode, add NeedsDeps
1 parent 2725838 commit 712090b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gen.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func loadPackage(path string, buildFirst bool, buildTags string) (*packages.Pack
9898
args = append(args, "-tags", buildTagStr)
9999
}
100100
args = append(args, "-v", path)
101-
fmt.Printf("go %v\n", strings.Join(args, " "))
101+
fmt.Printf("go %s\n", strings.Join(args, " "))
102102
cmd := exec.Command("go", args...)
103103
cmd.Stdin = os.Stdin
104104
cmd.Stdout = os.Stdout
@@ -115,7 +115,8 @@ func loadPackage(path string, buildFirst bool, buildTags string) (*packages.Pack
115115
}
116116

117117
// golang.org/x/tools/go/packages supports modules or GOPATH etc
118-
bpkgs, err := packages.Load(&packages.Config{Mode: packages.LoadTypes}, path)
118+
mode := packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedDeps | packages.NeedImports | packages.NeedTypes | packages.NeedTypesSizes
119+
bpkgs, err := packages.Load(&packages.Config{Mode: mode}, path)
119120
if err != nil {
120121
log.Printf("error resolving import path [%s]: %v\n",
121122
path,

0 commit comments

Comments
 (0)