mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go/internal/load: convert two global flags to an options struct
PackageOpts is a new struct type accepted by package loading functions. It initially has two fields: IgnoreImports, and ModResolveTests. Previously, these were global variables set by clients. We'll add more to this in the future. For #40775 Change-Id: I6956e56502de836d3815ce788bdf16fc5f3e5338 Reviewed-on: https://go-review.googlesource.com/c/go/+/310669 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
cde92846e2
commit
dc76c47565
14 changed files with 85 additions and 84 deletions
|
|
@ -117,7 +117,7 @@ func runClean(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cleanPkg {
|
if cleanPkg {
|
||||||
for _, pkg := range load.PackagesAndErrors(ctx, args) {
|
for _, pkg := range load.PackagesAndErrors(ctx, load.PackageOpts{}, args) {
|
||||||
clean(pkg)
|
clean(pkg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ See also: go fmt, go vet.
|
||||||
}
|
}
|
||||||
|
|
||||||
func runFix(ctx context.Context, cmd *base.Command, args []string) {
|
func runFix(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
pkgs := load.PackagesAndErrors(ctx, args)
|
pkgs := load.PackagesAndErrors(ctx, load.PackageOpts{}, args)
|
||||||
w := 0
|
w := 0
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
if pkg.Error != nil {
|
if pkg.Error != nil {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func runFmt(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
for _, pkg := range load.PackagesAndErrors(ctx, args) {
|
for _, pkg := range load.PackagesAndErrors(ctx, load.PackageOpts{}, args) {
|
||||||
if modload.Enabled() && pkg.Module != nil && !pkg.Module.Main {
|
if modload.Enabled() && pkg.Module != nil && !pkg.Module.Main {
|
||||||
if !printed {
|
if !printed {
|
||||||
fmt.Fprintf(os.Stderr, "go: not formatting packages in dependency modules\n")
|
fmt.Fprintf(os.Stderr, "go: not formatting packages in dependency modules\n")
|
||||||
|
|
|
||||||
|
|
@ -161,8 +161,6 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func runGenerate(ctx context.Context, cmd *base.Command, args []string) {
|
func runGenerate(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
load.IgnoreImports = true
|
|
||||||
|
|
||||||
if generateRunFlag != "" {
|
if generateRunFlag != "" {
|
||||||
var err error
|
var err error
|
||||||
generateRunRE, err = regexp.Compile(generateRunFlag)
|
generateRunRE, err = regexp.Compile(generateRunFlag)
|
||||||
|
|
@ -175,7 +173,8 @@ func runGenerate(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
|
|
||||||
// Even if the arguments are .go files, this loop suffices.
|
// Even if the arguments are .go files, this loop suffices.
|
||||||
printed := false
|
printed := false
|
||||||
for _, pkg := range load.PackagesAndErrors(ctx, args) {
|
pkgOpts := load.PackageOpts{IgnoreImports: true}
|
||||||
|
for _, pkg := range load.PackagesAndErrors(ctx, pkgOpts, args) {
|
||||||
if modload.Enabled() && pkg.Module != nil && !pkg.Module.Main {
|
if modload.Enabled() && pkg.Module != nil && !pkg.Module.Main {
|
||||||
if !printed {
|
if !printed {
|
||||||
fmt.Fprintf(os.Stderr, "go: not generating in packages in dependency modules\n")
|
fmt.Fprintf(os.Stderr, "go: not generating in packages in dependency modules\n")
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
// everything.
|
// everything.
|
||||||
load.ClearPackageCache()
|
load.ClearPackageCache()
|
||||||
|
|
||||||
pkgs := load.PackagesAndErrors(ctx, args)
|
pkgs := load.PackagesAndErrors(ctx, load.PackageOpts{}, args)
|
||||||
load.CheckPackageErrors(pkgs)
|
load.CheckPackageErrors(pkgs)
|
||||||
|
|
||||||
// Phase 3. Install.
|
// Phase 3. Install.
|
||||||
|
|
@ -248,9 +248,9 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int)
|
||||||
load1 := func(path string, mode int) *load.Package {
|
load1 := func(path string, mode int) *load.Package {
|
||||||
if parent == nil {
|
if parent == nil {
|
||||||
mode := 0 // don't do module or vendor resolution
|
mode := 0 // don't do module or vendor resolution
|
||||||
return load.LoadImport(context.TODO(), path, base.Cwd, nil, stk, nil, mode)
|
return load.LoadImport(context.TODO(), load.PackageOpts{}, path, base.Cwd, nil, stk, nil, mode)
|
||||||
}
|
}
|
||||||
return load.LoadImport(context.TODO(), path, parent.Dir, parent, stk, nil, mode|load.ResolveModule)
|
return load.LoadImport(context.TODO(), load.PackageOpts{}, path, parent.Dir, parent, stk, nil, mode|load.ResolveModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
p := load1(arg, mode)
|
p := load1(arg, mode)
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,6 @@ func runList(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
base.Fatalf("go list -f cannot be used with -json")
|
base.Fatalf("go list -f cannot be used with -json")
|
||||||
}
|
}
|
||||||
|
|
||||||
load.ModResolveTests = *listTest
|
|
||||||
work.BuildInit()
|
work.BuildInit()
|
||||||
out := newTrackingWriter(os.Stdout)
|
out := newTrackingWriter(os.Stdout)
|
||||||
defer out.w.Flush()
|
defer out.w.Flush()
|
||||||
|
|
@ -498,8 +497,11 @@ func runList(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
base.Fatalf("go list -test cannot be used with -find")
|
base.Fatalf("go list -test cannot be used with -find")
|
||||||
}
|
}
|
||||||
|
|
||||||
load.IgnoreImports = *listFind
|
pkgOpts := load.PackageOpts{
|
||||||
pkgs := load.PackagesAndErrors(ctx, args)
|
IgnoreImports: *listFind,
|
||||||
|
ModResolveTests: *listTest,
|
||||||
|
}
|
||||||
|
pkgs := load.PackagesAndErrors(ctx, pkgOpts, args)
|
||||||
if !*listE {
|
if !*listE {
|
||||||
w := 0
|
w := 0
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
|
|
@ -536,9 +538,9 @@ func runList(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
var pmain, ptest, pxtest *load.Package
|
var pmain, ptest, pxtest *load.Package
|
||||||
var err error
|
var err error
|
||||||
if *listE {
|
if *listE {
|
||||||
pmain, ptest, pxtest = load.TestPackagesAndErrors(ctx, p, nil)
|
pmain, ptest, pxtest = load.TestPackagesAndErrors(ctx, pkgOpts, p, nil)
|
||||||
} else {
|
} else {
|
||||||
pmain, ptest, pxtest, err = load.TestPackagesFor(ctx, p, nil)
|
pmain, ptest, pxtest, err = load.TestPackagesFor(ctx, pkgOpts, p, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.Errorf("can't load test package: %s", err)
|
base.Errorf("can't load test package: %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,6 @@ import (
|
||||||
"golang.org/x/mod/module"
|
"golang.org/x/mod/module"
|
||||||
)
|
)
|
||||||
|
|
||||||
var IgnoreImports bool // control whether we ignore imports in packages
|
|
||||||
|
|
||||||
// A Package describes a single package found in a directory.
|
// A Package describes a single package found in a directory.
|
||||||
type Package struct {
|
type Package struct {
|
||||||
PackagePublic // visible in 'go list'
|
PackagePublic // visible in 'go list'
|
||||||
|
|
@ -345,7 +343,7 @@ type CoverVar struct {
|
||||||
Var string // name of count struct
|
Var string // name of count struct
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Package) copyBuild(pp *build.Package) {
|
func (p *Package) copyBuild(opts PackageOpts, pp *build.Package) {
|
||||||
p.Internal.Build = pp
|
p.Internal.Build = pp
|
||||||
|
|
||||||
if pp.PkgTargetRoot != "" && cfg.BuildPkgdir != "" {
|
if pp.PkgTargetRoot != "" && cfg.BuildPkgdir != "" {
|
||||||
|
|
@ -394,7 +392,7 @@ func (p *Package) copyBuild(pp *build.Package) {
|
||||||
p.TestImports = pp.TestImports
|
p.TestImports = pp.TestImports
|
||||||
p.XTestGoFiles = pp.XTestGoFiles
|
p.XTestGoFiles = pp.XTestGoFiles
|
||||||
p.XTestImports = pp.XTestImports
|
p.XTestImports = pp.XTestImports
|
||||||
if IgnoreImports {
|
if opts.IgnoreImports {
|
||||||
p.Imports = nil
|
p.Imports = nil
|
||||||
p.Internal.RawImports = nil
|
p.Internal.RawImports = nil
|
||||||
p.TestImports = nil
|
p.TestImports = nil
|
||||||
|
|
@ -601,7 +599,7 @@ func ReloadPackageNoFlags(arg string, stk *ImportStack) *Package {
|
||||||
})
|
})
|
||||||
packageDataCache.Delete(p.ImportPath)
|
packageDataCache.Delete(p.ImportPath)
|
||||||
}
|
}
|
||||||
return LoadImport(context.TODO(), arg, base.Cwd, nil, stk, nil, 0)
|
return LoadImport(context.TODO(), PackageOpts{}, arg, base.Cwd, nil, stk, nil, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// dirToImportPath returns the pseudo-import path we use for a package
|
// dirToImportPath returns the pseudo-import path we use for a package
|
||||||
|
|
@ -653,11 +651,11 @@ const (
|
||||||
// LoadImport does not set tool flags and should only be used by
|
// LoadImport does not set tool flags and should only be used by
|
||||||
// this package, as part of a bigger load operation, and by GOPATH-based "go get".
|
// this package, as part of a bigger load operation, and by GOPATH-based "go get".
|
||||||
// TODO(rsc): When GOPATH-based "go get" is removed, unexport this function.
|
// TODO(rsc): When GOPATH-based "go get" is removed, unexport this function.
|
||||||
func LoadImport(ctx context.Context, path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package {
|
func LoadImport(ctx context.Context, opts PackageOpts, path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package {
|
||||||
return loadImport(ctx, nil, path, srcDir, parent, stk, importPos, mode)
|
return loadImport(ctx, opts, nil, path, srcDir, parent, stk, importPos, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadImport(ctx context.Context, pre *preload, path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package {
|
func loadImport(ctx context.Context, opts PackageOpts, pre *preload, path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package {
|
||||||
if path == "" {
|
if path == "" {
|
||||||
panic("LoadImport called with empty package path")
|
panic("LoadImport called with empty package path")
|
||||||
}
|
}
|
||||||
|
|
@ -670,8 +668,8 @@ func loadImport(ctx context.Context, pre *preload, path, srcDir string, parent *
|
||||||
parentIsStd = parent.Standard
|
parentIsStd = parent.Standard
|
||||||
}
|
}
|
||||||
bp, loaded, err := loadPackageData(ctx, path, parentPath, srcDir, parentRoot, parentIsStd, mode)
|
bp, loaded, err := loadPackageData(ctx, path, parentPath, srcDir, parentRoot, parentIsStd, mode)
|
||||||
if loaded && pre != nil && !IgnoreImports {
|
if loaded && pre != nil && !opts.IgnoreImports {
|
||||||
pre.preloadImports(ctx, bp.Imports, bp)
|
pre.preloadImports(ctx, opts, bp.Imports, bp)
|
||||||
}
|
}
|
||||||
if bp == nil {
|
if bp == nil {
|
||||||
p := &Package{
|
p := &Package{
|
||||||
|
|
@ -710,7 +708,7 @@ func loadImport(ctx context.Context, pre *preload, path, srcDir string, parent *
|
||||||
// Load package.
|
// Load package.
|
||||||
// loadPackageData may return bp != nil even if an error occurs,
|
// loadPackageData may return bp != nil even if an error occurs,
|
||||||
// in order to return partial information.
|
// in order to return partial information.
|
||||||
p.load(ctx, path, stk, importPos, bp, err)
|
p.load(ctx, opts, path, stk, importPos, bp, err)
|
||||||
|
|
||||||
if !cfg.ModulesEnabled && path != cleanImport(path) {
|
if !cfg.ModulesEnabled && path != cleanImport(path) {
|
||||||
p.Error = &PackageError{
|
p.Error = &PackageError{
|
||||||
|
|
@ -980,7 +978,7 @@ func newPreload() *preload {
|
||||||
// preloadMatches loads data for package paths matched by patterns.
|
// preloadMatches loads data for package paths matched by patterns.
|
||||||
// When preloadMatches returns, some packages may not be loaded yet, but
|
// When preloadMatches returns, some packages may not be loaded yet, but
|
||||||
// loadPackageData and loadImport are always safe to call.
|
// loadPackageData and loadImport are always safe to call.
|
||||||
func (pre *preload) preloadMatches(ctx context.Context, matches []*search.Match) {
|
func (pre *preload) preloadMatches(ctx context.Context, opts PackageOpts, matches []*search.Match) {
|
||||||
for _, m := range matches {
|
for _, m := range matches {
|
||||||
for _, pkg := range m.Pkgs {
|
for _, pkg := range m.Pkgs {
|
||||||
select {
|
select {
|
||||||
|
|
@ -991,8 +989,8 @@ func (pre *preload) preloadMatches(ctx context.Context, matches []*search.Match)
|
||||||
mode := 0 // don't use vendoring or module import resolution
|
mode := 0 // don't use vendoring or module import resolution
|
||||||
bp, loaded, err := loadPackageData(ctx, pkg, "", base.Cwd, "", false, mode)
|
bp, loaded, err := loadPackageData(ctx, pkg, "", base.Cwd, "", false, mode)
|
||||||
<-pre.sema
|
<-pre.sema
|
||||||
if bp != nil && loaded && err == nil && !IgnoreImports {
|
if bp != nil && loaded && err == nil && !opts.IgnoreImports {
|
||||||
pre.preloadImports(ctx, bp.Imports, bp)
|
pre.preloadImports(ctx, opts, bp.Imports, bp)
|
||||||
}
|
}
|
||||||
}(pkg)
|
}(pkg)
|
||||||
}
|
}
|
||||||
|
|
@ -1003,7 +1001,7 @@ func (pre *preload) preloadMatches(ctx context.Context, matches []*search.Match)
|
||||||
// preloadImports queues a list of imports for preloading.
|
// preloadImports queues a list of imports for preloading.
|
||||||
// When preloadImports returns, some packages may not be loaded yet,
|
// When preloadImports returns, some packages may not be loaded yet,
|
||||||
// but loadPackageData and loadImport are always safe to call.
|
// but loadPackageData and loadImport are always safe to call.
|
||||||
func (pre *preload) preloadImports(ctx context.Context, imports []string, parent *build.Package) {
|
func (pre *preload) preloadImports(ctx context.Context, opts PackageOpts, imports []string, parent *build.Package) {
|
||||||
parentIsStd := parent.Goroot && parent.ImportPath != "" && search.IsStandardImportPath(parent.ImportPath)
|
parentIsStd := parent.Goroot && parent.ImportPath != "" && search.IsStandardImportPath(parent.ImportPath)
|
||||||
for _, path := range imports {
|
for _, path := range imports {
|
||||||
if path == "C" || path == "unsafe" {
|
if path == "C" || path == "unsafe" {
|
||||||
|
|
@ -1016,8 +1014,8 @@ func (pre *preload) preloadImports(ctx context.Context, imports []string, parent
|
||||||
go func(path string) {
|
go func(path string) {
|
||||||
bp, loaded, err := loadPackageData(ctx, path, parent.ImportPath, parent.Dir, parent.Root, parentIsStd, ResolveImport)
|
bp, loaded, err := loadPackageData(ctx, path, parent.ImportPath, parent.Dir, parent.Root, parentIsStd, ResolveImport)
|
||||||
<-pre.sema
|
<-pre.sema
|
||||||
if bp != nil && loaded && err == nil && !IgnoreImports {
|
if bp != nil && loaded && err == nil && !opts.IgnoreImports {
|
||||||
pre.preloadImports(ctx, bp.Imports, bp)
|
pre.preloadImports(ctx, opts, bp.Imports, bp)
|
||||||
}
|
}
|
||||||
}(path)
|
}(path)
|
||||||
}
|
}
|
||||||
|
|
@ -1667,8 +1665,8 @@ func (p *Package) DefaultExecName() string {
|
||||||
// load populates p using information from bp, err, which should
|
// load populates p using information from bp, err, which should
|
||||||
// be the result of calling build.Context.Import.
|
// be the result of calling build.Context.Import.
|
||||||
// stk contains the import stack, not including path itself.
|
// stk contains the import stack, not including path itself.
|
||||||
func (p *Package) load(ctx context.Context, path string, stk *ImportStack, importPos []token.Position, bp *build.Package, err error) {
|
func (p *Package) load(ctx context.Context, opts PackageOpts, path string, stk *ImportStack, importPos []token.Position, bp *build.Package, err error) {
|
||||||
p.copyBuild(bp)
|
p.copyBuild(opts, bp)
|
||||||
|
|
||||||
// The localPrefix is the path we interpret ./ imports relative to.
|
// The localPrefix is the path we interpret ./ imports relative to.
|
||||||
// Synthesized main packages sometimes override this.
|
// Synthesized main packages sometimes override this.
|
||||||
|
|
@ -1887,7 +1885,7 @@ func (p *Package) load(ctx context.Context, path string, stk *ImportStack, impor
|
||||||
if path == "C" {
|
if path == "C" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
p1 := LoadImport(ctx, path, p.Dir, p, stk, p.Internal.Build.ImportPos[path], ResolveImport)
|
p1 := LoadImport(ctx, opts, path, p.Dir, p, stk, p.Internal.Build.ImportPos[path], ResolveImport)
|
||||||
|
|
||||||
path = p1.ImportPath
|
path = p1.ImportPath
|
||||||
importPaths[i] = path
|
importPaths[i] = path
|
||||||
|
|
@ -2334,7 +2332,7 @@ func PackageList(roots []*Package) []*Package {
|
||||||
// TestPackageList returns the list of packages in the dag rooted at roots
|
// TestPackageList returns the list of packages in the dag rooted at roots
|
||||||
// as visited in a depth-first post-order traversal, including the test
|
// as visited in a depth-first post-order traversal, including the test
|
||||||
// imports of the roots. This ignores errors in test packages.
|
// imports of the roots. This ignores errors in test packages.
|
||||||
func TestPackageList(ctx context.Context, roots []*Package) []*Package {
|
func TestPackageList(ctx context.Context, opts PackageOpts, roots []*Package) []*Package {
|
||||||
seen := map[*Package]bool{}
|
seen := map[*Package]bool{}
|
||||||
all := []*Package{}
|
all := []*Package{}
|
||||||
var walk func(*Package)
|
var walk func(*Package)
|
||||||
|
|
@ -2350,7 +2348,7 @@ func TestPackageList(ctx context.Context, roots []*Package) []*Package {
|
||||||
}
|
}
|
||||||
walkTest := func(root *Package, path string) {
|
walkTest := func(root *Package, path string) {
|
||||||
var stk ImportStack
|
var stk ImportStack
|
||||||
p1 := LoadImport(ctx, path, root.Dir, root, &stk, root.Internal.Build.TestImportPos[path], ResolveImport)
|
p1 := LoadImport(ctx, opts, path, root.Dir, root, &stk, root.Internal.Build.TestImportPos[path], ResolveImport)
|
||||||
if p1.Error == nil {
|
if p1.Error == nil {
|
||||||
walk(p1)
|
walk(p1)
|
||||||
}
|
}
|
||||||
|
|
@ -2373,11 +2371,17 @@ func TestPackageList(ctx context.Context, roots []*Package) []*Package {
|
||||||
// TODO(jayconrod): delete this function and set flags automatically
|
// TODO(jayconrod): delete this function and set flags automatically
|
||||||
// in LoadImport instead.
|
// in LoadImport instead.
|
||||||
func LoadImportWithFlags(path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package {
|
func LoadImportWithFlags(path, srcDir string, parent *Package, stk *ImportStack, importPos []token.Position, mode int) *Package {
|
||||||
p := LoadImport(context.TODO(), path, srcDir, parent, stk, importPos, mode)
|
p := LoadImport(context.TODO(), PackageOpts{}, path, srcDir, parent, stk, importPos, mode)
|
||||||
setToolFlags(p)
|
setToolFlags(p)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PackageOpts control the behavior of PackagesAndErrors and other package
|
||||||
|
// loading functions.
|
||||||
|
type PackageOpts struct {
|
||||||
|
// IgnoreImports controls whether we ignore imports when loading packages.
|
||||||
|
IgnoreImports bool
|
||||||
|
|
||||||
// ModResolveTests indicates whether calls to the module loader should also
|
// ModResolveTests indicates whether calls to the module loader should also
|
||||||
// resolve test dependencies of the requested packages.
|
// resolve test dependencies of the requested packages.
|
||||||
//
|
//
|
||||||
|
|
@ -2385,10 +2389,8 @@ func LoadImportWithFlags(path, srcDir string, parent *Package, stk *ImportStack,
|
||||||
// dependencies at the same time as packages; otherwise, the test dependencies
|
// dependencies at the same time as packages; otherwise, the test dependencies
|
||||||
// of those packages could be missing, and resolving those missing dependencies
|
// of those packages could be missing, and resolving those missing dependencies
|
||||||
// could change the selected versions of modules that provide other packages.
|
// could change the selected versions of modules that provide other packages.
|
||||||
//
|
ModResolveTests bool
|
||||||
// TODO(#40775): Change this from a global variable to an explicit function
|
}
|
||||||
// argument where needed.
|
|
||||||
var ModResolveTests bool
|
|
||||||
|
|
||||||
// PackagesAndErrors returns the packages named by the command line arguments
|
// PackagesAndErrors returns the packages named by the command line arguments
|
||||||
// 'patterns'. If a named package cannot be loaded, PackagesAndErrors returns
|
// 'patterns'. If a named package cannot be loaded, PackagesAndErrors returns
|
||||||
|
|
@ -2398,7 +2400,7 @@ var ModResolveTests bool
|
||||||
//
|
//
|
||||||
// To obtain a flat list of packages, use PackageList.
|
// To obtain a flat list of packages, use PackageList.
|
||||||
// To report errors loading packages, use ReportPackageErrors.
|
// To report errors loading packages, use ReportPackageErrors.
|
||||||
func PackagesAndErrors(ctx context.Context, patterns []string) []*Package {
|
func PackagesAndErrors(ctx context.Context, opts PackageOpts, patterns []string) []*Package {
|
||||||
ctx, span := trace.StartSpan(ctx, "load.PackagesAndErrors")
|
ctx, span := trace.StartSpan(ctx, "load.PackagesAndErrors")
|
||||||
defer span.Done()
|
defer span.Done()
|
||||||
|
|
||||||
|
|
@ -2410,19 +2412,19 @@ func PackagesAndErrors(ctx context.Context, patterns []string) []*Package {
|
||||||
// We need to test whether the path is an actual Go file and not a
|
// We need to test whether the path is an actual Go file and not a
|
||||||
// package path or pattern ending in '.go' (see golang.org/issue/34653).
|
// package path or pattern ending in '.go' (see golang.org/issue/34653).
|
||||||
if fi, err := fsys.Stat(p); err == nil && !fi.IsDir() {
|
if fi, err := fsys.Stat(p); err == nil && !fi.IsDir() {
|
||||||
return []*Package{GoFilesPackage(ctx, patterns)}
|
return []*Package{GoFilesPackage(ctx, opts, patterns)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var matches []*search.Match
|
var matches []*search.Match
|
||||||
if modload.Init(); cfg.ModulesEnabled {
|
if modload.Init(); cfg.ModulesEnabled {
|
||||||
loadOpts := modload.PackageOpts{
|
modOpts := modload.PackageOpts{
|
||||||
ResolveMissingImports: true,
|
ResolveMissingImports: true,
|
||||||
LoadTests: ModResolveTests,
|
LoadTests: opts.ModResolveTests,
|
||||||
SilenceErrors: true,
|
SilenceErrors: true,
|
||||||
}
|
}
|
||||||
matches, _ = modload.LoadPackages(ctx, loadOpts, patterns...)
|
matches, _ = modload.LoadPackages(ctx, modOpts, patterns...)
|
||||||
} else {
|
} else {
|
||||||
matches = search.ImportPaths(patterns)
|
matches = search.ImportPaths(patterns)
|
||||||
}
|
}
|
||||||
|
|
@ -2435,14 +2437,14 @@ func PackagesAndErrors(ctx context.Context, patterns []string) []*Package {
|
||||||
|
|
||||||
pre := newPreload()
|
pre := newPreload()
|
||||||
defer pre.flush()
|
defer pre.flush()
|
||||||
pre.preloadMatches(ctx, matches)
|
pre.preloadMatches(ctx, opts, matches)
|
||||||
|
|
||||||
for _, m := range matches {
|
for _, m := range matches {
|
||||||
for _, pkg := range m.Pkgs {
|
for _, pkg := range m.Pkgs {
|
||||||
if pkg == "" {
|
if pkg == "" {
|
||||||
panic(fmt.Sprintf("ImportPaths returned empty package for pattern %s", m.Pattern()))
|
panic(fmt.Sprintf("ImportPaths returned empty package for pattern %s", m.Pattern()))
|
||||||
}
|
}
|
||||||
p := loadImport(ctx, pre, pkg, base.Cwd, nil, &stk, nil, 0)
|
p := loadImport(ctx, opts, pre, pkg, base.Cwd, nil, &stk, nil, 0)
|
||||||
p.Match = append(p.Match, m.Pattern())
|
p.Match = append(p.Match, m.Pattern())
|
||||||
p.Internal.CmdlinePkg = true
|
p.Internal.CmdlinePkg = true
|
||||||
if m.IsLiteral() {
|
if m.IsLiteral() {
|
||||||
|
|
@ -2538,7 +2540,7 @@ func setToolFlags(pkgs ...*Package) {
|
||||||
// GoFilesPackage creates a package for building a collection of Go files
|
// GoFilesPackage creates a package for building a collection of Go files
|
||||||
// (typically named on the command line). The target is named p.a for
|
// (typically named on the command line). The target is named p.a for
|
||||||
// package p or named after the first Go file for package main.
|
// package p or named after the first Go file for package main.
|
||||||
func GoFilesPackage(ctx context.Context, gofiles []string) *Package {
|
func GoFilesPackage(ctx context.Context, opts PackageOpts, gofiles []string) *Package {
|
||||||
modload.Init()
|
modload.Init()
|
||||||
|
|
||||||
for _, f := range gofiles {
|
for _, f := range gofiles {
|
||||||
|
|
@ -2602,7 +2604,7 @@ func GoFilesPackage(ctx context.Context, gofiles []string) *Package {
|
||||||
pkg := new(Package)
|
pkg := new(Package)
|
||||||
pkg.Internal.Local = true
|
pkg.Internal.Local = true
|
||||||
pkg.Internal.CmdlineFiles = true
|
pkg.Internal.CmdlineFiles = true
|
||||||
pkg.load(ctx, "command-line-arguments", &stk, nil, bp, err)
|
pkg.load(ctx, opts, "command-line-arguments", &stk, nil, bp, err)
|
||||||
pkg.Internal.LocalPrefix = dirToImportPath(dir)
|
pkg.Internal.LocalPrefix = dirToImportPath(dir)
|
||||||
pkg.ImportPath = "command-line-arguments"
|
pkg.ImportPath = "command-line-arguments"
|
||||||
pkg.Target = ""
|
pkg.Target = ""
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ type TestCover struct {
|
||||||
// TestPackagesFor is like TestPackagesAndErrors but it returns
|
// TestPackagesFor is like TestPackagesAndErrors but it returns
|
||||||
// an error if the test packages or their dependencies have errors.
|
// an error if the test packages or their dependencies have errors.
|
||||||
// Only test packages without errors are returned.
|
// Only test packages without errors are returned.
|
||||||
func TestPackagesFor(ctx context.Context, p *Package, cover *TestCover) (pmain, ptest, pxtest *Package, err error) {
|
func TestPackagesFor(ctx context.Context, opts PackageOpts, p *Package, cover *TestCover) (pmain, ptest, pxtest *Package, err error) {
|
||||||
pmain, ptest, pxtest = TestPackagesAndErrors(ctx, p, cover)
|
pmain, ptest, pxtest = TestPackagesAndErrors(ctx, opts, p, cover)
|
||||||
for _, p1 := range []*Package{ptest, pxtest, pmain} {
|
for _, p1 := range []*Package{ptest, pxtest, pmain} {
|
||||||
if p1 == nil {
|
if p1 == nil {
|
||||||
// pxtest may be nil
|
// pxtest may be nil
|
||||||
|
|
@ -93,7 +93,7 @@ func TestPackagesFor(ctx context.Context, p *Package, cover *TestCover) (pmain,
|
||||||
//
|
//
|
||||||
// The caller is expected to have checked that len(p.TestGoFiles)+len(p.XTestGoFiles) > 0,
|
// The caller is expected to have checked that len(p.TestGoFiles)+len(p.XTestGoFiles) > 0,
|
||||||
// or else there's no point in any of this.
|
// or else there's no point in any of this.
|
||||||
func TestPackagesAndErrors(ctx context.Context, p *Package, cover *TestCover) (pmain, ptest, pxtest *Package) {
|
func TestPackagesAndErrors(ctx context.Context, opts PackageOpts, p *Package, cover *TestCover) (pmain, ptest, pxtest *Package) {
|
||||||
ctx, span := trace.StartSpan(ctx, "load.TestPackagesAndErrors")
|
ctx, span := trace.StartSpan(ctx, "load.TestPackagesAndErrors")
|
||||||
defer span.Done()
|
defer span.Done()
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ func TestPackagesAndErrors(ctx context.Context, p *Package, cover *TestCover) (p
|
||||||
defer pre.flush()
|
defer pre.flush()
|
||||||
allImports := append([]string{}, p.TestImports...)
|
allImports := append([]string{}, p.TestImports...)
|
||||||
allImports = append(allImports, p.XTestImports...)
|
allImports = append(allImports, p.XTestImports...)
|
||||||
pre.preloadImports(ctx, allImports, p.Internal.Build)
|
pre.preloadImports(ctx, opts, allImports, p.Internal.Build)
|
||||||
|
|
||||||
var ptestErr, pxtestErr *PackageError
|
var ptestErr, pxtestErr *PackageError
|
||||||
var imports, ximports []*Package
|
var imports, ximports []*Package
|
||||||
|
|
@ -110,7 +110,7 @@ func TestPackagesAndErrors(ctx context.Context, p *Package, cover *TestCover) (p
|
||||||
stk.Push(p.ImportPath + " (test)")
|
stk.Push(p.ImportPath + " (test)")
|
||||||
rawTestImports := str.StringList(p.TestImports)
|
rawTestImports := str.StringList(p.TestImports)
|
||||||
for i, path := range p.TestImports {
|
for i, path := range p.TestImports {
|
||||||
p1 := loadImport(ctx, pre, path, p.Dir, p, &stk, p.Internal.Build.TestImportPos[path], ResolveImport)
|
p1 := loadImport(ctx, opts, pre, path, p.Dir, p, &stk, p.Internal.Build.TestImportPos[path], ResolveImport)
|
||||||
if str.Contains(p1.Deps, p.ImportPath) || p1.ImportPath == p.ImportPath {
|
if str.Contains(p1.Deps, p.ImportPath) || p1.ImportPath == p.ImportPath {
|
||||||
// Same error that loadPackage returns (via reusePackage) in pkg.go.
|
// Same error that loadPackage returns (via reusePackage) in pkg.go.
|
||||||
// Can't change that code, because that code is only for loading the
|
// Can't change that code, because that code is only for loading the
|
||||||
|
|
@ -140,7 +140,7 @@ func TestPackagesAndErrors(ctx context.Context, p *Package, cover *TestCover) (p
|
||||||
pxtestNeedsPtest := false
|
pxtestNeedsPtest := false
|
||||||
rawXTestImports := str.StringList(p.XTestImports)
|
rawXTestImports := str.StringList(p.XTestImports)
|
||||||
for i, path := range p.XTestImports {
|
for i, path := range p.XTestImports {
|
||||||
p1 := loadImport(ctx, pre, path, p.Dir, p, &stk, p.Internal.Build.XTestImportPos[path], ResolveImport)
|
p1 := loadImport(ctx, opts, pre, path, p.Dir, p, &stk, p.Internal.Build.XTestImportPos[path], ResolveImport)
|
||||||
if p1.ImportPath == p.ImportPath {
|
if p1.ImportPath == p.ImportPath {
|
||||||
pxtestNeedsPtest = true
|
pxtestNeedsPtest = true
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -281,7 +281,7 @@ func TestPackagesAndErrors(ctx context.Context, p *Package, cover *TestCover) (p
|
||||||
if dep == ptest.ImportPath {
|
if dep == ptest.ImportPath {
|
||||||
pmain.Internal.Imports = append(pmain.Internal.Imports, ptest)
|
pmain.Internal.Imports = append(pmain.Internal.Imports, ptest)
|
||||||
} else {
|
} else {
|
||||||
p1 := loadImport(ctx, pre, dep, "", nil, &stk, nil, 0)
|
p1 := loadImport(ctx, opts, pre, dep, "", nil, &stk, nil, 0)
|
||||||
pmain.Internal.Imports = append(pmain.Internal.Imports, p1)
|
pmain.Internal.Imports = append(pmain.Internal.Imports, p1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,6 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
if *getInsecure {
|
if *getInsecure {
|
||||||
base.Fatalf("go get: -insecure flag is no longer supported; use GOINSECURE instead")
|
base.Fatalf("go get: -insecure flag is no longer supported; use GOINSECURE instead")
|
||||||
}
|
}
|
||||||
load.ModResolveTests = *getT
|
|
||||||
|
|
||||||
// Do not allow any updating of go.mod until we've applied
|
// Do not allow any updating of go.mod until we've applied
|
||||||
// all the requested changes and checked that the result matches
|
// all the requested changes and checked that the result matches
|
||||||
|
|
@ -368,8 +367,9 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
if !*getD && len(pkgPatterns) > 0 {
|
if !*getD && len(pkgPatterns) > 0 {
|
||||||
work.BuildInit()
|
work.BuildInit()
|
||||||
|
|
||||||
|
pkgOpts := load.PackageOpts{ModResolveTests: *getT}
|
||||||
var pkgs []*load.Package
|
var pkgs []*load.Package
|
||||||
for _, pkg := range load.PackagesAndErrors(ctx, pkgPatterns) {
|
for _, pkg := range load.PackagesAndErrors(ctx, pkgOpts, pkgPatterns) {
|
||||||
if pkg.Error != nil {
|
if pkg.Error != nil {
|
||||||
var noGo *load.NoGoError
|
var noGo *load.NoGoError
|
||||||
if errors.As(pkg.Error.Err, &noGo) {
|
if errors.As(pkg.Error.Err, &noGo) {
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,9 @@ func runRun(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
base.Fatalf("go run: cannot run *_test.go files (%s)", file)
|
base.Fatalf("go run: cannot run *_test.go files (%s)", file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p = load.GoFilesPackage(ctx, files)
|
p = load.GoFilesPackage(ctx, load.PackageOpts{}, files)
|
||||||
} else if len(args) > 0 && !strings.HasPrefix(args[0], "-") {
|
} else if len(args) > 0 && !strings.HasPrefix(args[0], "-") {
|
||||||
pkgs := load.PackagesAndErrors(ctx, args[:1])
|
pkgs := load.PackagesAndErrors(ctx, load.PackageOpts{}, args[:1])
|
||||||
if len(pkgs) == 0 {
|
if len(pkgs) == 0 {
|
||||||
base.Fatalf("go run: no packages loaded from %s", args[0])
|
base.Fatalf("go run: no packages loaded from %s", args[0])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -569,8 +569,6 @@ var defaultVetFlags = []string{
|
||||||
}
|
}
|
||||||
|
|
||||||
func runTest(ctx context.Context, cmd *base.Command, args []string) {
|
func runTest(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
load.ModResolveTests = true
|
|
||||||
|
|
||||||
pkgArgs, testArgs = testFlags(args)
|
pkgArgs, testArgs = testFlags(args)
|
||||||
|
|
||||||
if cfg.DebugTrace != "" {
|
if cfg.DebugTrace != "" {
|
||||||
|
|
@ -596,7 +594,8 @@ func runTest(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
work.VetFlags = testVet.flags
|
work.VetFlags = testVet.flags
|
||||||
work.VetExplicit = testVet.explicit
|
work.VetExplicit = testVet.explicit
|
||||||
|
|
||||||
pkgs = load.PackagesAndErrors(ctx, pkgArgs)
|
pkgOpts := load.PackageOpts{ModResolveTests: true}
|
||||||
|
pkgs = load.PackagesAndErrors(ctx, pkgOpts, pkgArgs)
|
||||||
load.CheckPackageErrors(pkgs)
|
load.CheckPackageErrors(pkgs)
|
||||||
if len(pkgs) == 0 {
|
if len(pkgs) == 0 {
|
||||||
base.Fatalf("no packages to test")
|
base.Fatalf("no packages to test")
|
||||||
|
|
@ -680,7 +679,7 @@ func runTest(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
sort.Strings(all)
|
sort.Strings(all)
|
||||||
|
|
||||||
a := &work.Action{Mode: "go test -i"}
|
a := &work.Action{Mode: "go test -i"}
|
||||||
pkgs := load.PackagesAndErrors(ctx, all)
|
pkgs := load.PackagesAndErrors(ctx, pkgOpts, all)
|
||||||
load.CheckPackageErrors(pkgs)
|
load.CheckPackageErrors(pkgs)
|
||||||
for _, p := range pkgs {
|
for _, p := range pkgs {
|
||||||
if cfg.BuildToolchainName == "gccgo" && p.Standard {
|
if cfg.BuildToolchainName == "gccgo" && p.Standard {
|
||||||
|
|
@ -707,7 +706,7 @@ func runTest(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select for coverage all dependencies matching the testCoverPaths patterns.
|
// Select for coverage all dependencies matching the testCoverPaths patterns.
|
||||||
for _, p := range load.TestPackageList(ctx, pkgs) {
|
for _, p := range load.TestPackageList(ctx, pkgOpts, pkgs) {
|
||||||
haveMatch := false
|
haveMatch := false
|
||||||
for i := range testCoverPaths {
|
for i := range testCoverPaths {
|
||||||
if match[i](p) {
|
if match[i](p) {
|
||||||
|
|
@ -775,7 +774,7 @@ func runTest(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
ensureImport(p, "sync/atomic")
|
ensureImport(p, "sync/atomic")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTest, runTest, printTest, err := builderTest(&b, ctx, p)
|
buildTest, runTest, printTest, err := builderTest(&b, ctx, pkgOpts, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
str := err.Error()
|
str := err.Error()
|
||||||
str = strings.TrimPrefix(str, "\n")
|
str = strings.TrimPrefix(str, "\n")
|
||||||
|
|
@ -842,7 +841,7 @@ var windowsBadWords = []string{
|
||||||
"update",
|
"update",
|
||||||
}
|
}
|
||||||
|
|
||||||
func builderTest(b *work.Builder, ctx context.Context, p *load.Package) (buildAction, runAction, printAction *work.Action, err error) {
|
func builderTest(b *work.Builder, ctx context.Context, pkgOpts load.PackageOpts, p *load.Package) (buildAction, runAction, printAction *work.Action, err error) {
|
||||||
if len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 {
|
if len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 {
|
||||||
build := b.CompileAction(work.ModeBuild, work.ModeBuild, p)
|
build := b.CompileAction(work.ModeBuild, work.ModeBuild, p)
|
||||||
run := &work.Action{Mode: "test run", Package: p, Deps: []*work.Action{build}}
|
run := &work.Action{Mode: "test run", Package: p, Deps: []*work.Action{build}}
|
||||||
|
|
@ -865,7 +864,7 @@ func builderTest(b *work.Builder, ctx context.Context, p *load.Package) (buildAc
|
||||||
DeclVars: declareCoverVars,
|
DeclVars: declareCoverVars,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pmain, ptest, pxtest, err := load.TestPackagesFor(ctx, p, cover)
|
pmain, ptest, pxtest, err := load.TestPackagesFor(ctx, pkgOpts, p, cover)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,6 @@ See also: go fmt, go fix.
|
||||||
}
|
}
|
||||||
|
|
||||||
func runVet(ctx context.Context, cmd *base.Command, args []string) {
|
func runVet(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
load.ModResolveTests = true
|
|
||||||
|
|
||||||
vetFlags, pkgArgs := vetFlags(args)
|
vetFlags, pkgArgs := vetFlags(args)
|
||||||
|
|
||||||
if cfg.DebugTrace != "" {
|
if cfg.DebugTrace != "" {
|
||||||
|
|
@ -87,7 +85,8 @@ func runVet(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgs := load.PackagesAndErrors(ctx, pkgArgs)
|
pkgOpts := load.PackageOpts{ModResolveTests: true}
|
||||||
|
pkgs := load.PackagesAndErrors(ctx, pkgOpts, pkgArgs)
|
||||||
load.CheckPackageErrors(pkgs)
|
load.CheckPackageErrors(pkgs)
|
||||||
if len(pkgs) == 0 {
|
if len(pkgs) == 0 {
|
||||||
base.Fatalf("no packages to vet")
|
base.Fatalf("no packages to vet")
|
||||||
|
|
@ -98,7 +97,7 @@ func runVet(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
|
|
||||||
root := &work.Action{Mode: "go vet"}
|
root := &work.Action{Mode: "go vet"}
|
||||||
for _, p := range pkgs {
|
for _, p := range pkgs {
|
||||||
_, ptest, pxtest, err := load.TestPackagesFor(ctx, p, nil)
|
_, ptest, pxtest, err := load.TestPackagesFor(ctx, pkgOpts, p, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.Errorf("%v", err)
|
base.Errorf("%v", err)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ func runBuild(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
var b Builder
|
var b Builder
|
||||||
b.Init()
|
b.Init()
|
||||||
|
|
||||||
pkgs := load.PackagesAndErrors(ctx, args)
|
pkgs := load.PackagesAndErrors(ctx, load.PackageOpts{}, args)
|
||||||
load.CheckPackageErrors(pkgs)
|
load.CheckPackageErrors(pkgs)
|
||||||
|
|
||||||
explicitO := len(cfg.BuildO) > 0
|
explicitO := len(cfg.BuildO) > 0
|
||||||
|
|
@ -592,7 +592,7 @@ func runInstall(ctx context.Context, cmd *base.Command, args []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildInit()
|
BuildInit()
|
||||||
pkgs := load.PackagesAndErrors(ctx, args)
|
pkgs := load.PackagesAndErrors(ctx, load.PackageOpts{}, args)
|
||||||
if cfg.ModulesEnabled && !modload.HasModRoot() {
|
if cfg.ModulesEnabled && !modload.HasModRoot() {
|
||||||
haveErrors := false
|
haveErrors := false
|
||||||
allMissingErrors := true
|
allMissingErrors := true
|
||||||
|
|
@ -857,7 +857,7 @@ func installOutsideModule(ctx context.Context, args []string) {
|
||||||
|
|
||||||
// TODO(golang.org/issue/40276): don't report errors loading non-main packages
|
// TODO(golang.org/issue/40276): don't report errors loading non-main packages
|
||||||
// matched by a pattern.
|
// matched by a pattern.
|
||||||
pkgs := load.PackagesAndErrors(ctx, patterns)
|
pkgs := load.PackagesAndErrors(ctx, load.PackageOpts{}, patterns)
|
||||||
load.CheckPackageErrors(pkgs)
|
load.CheckPackageErrors(pkgs)
|
||||||
mainPkgs := make([]*load.Package, 0, len(pkgs))
|
mainPkgs := make([]*load.Package, 0, len(pkgs))
|
||||||
mainCount := make([]int, len(patterns))
|
mainCount := make([]int, len(patterns))
|
||||||
|
|
|
||||||
|
|
@ -3105,7 +3105,7 @@ func (b *Builder) swigDoIntSize(objdir string) (intsize string, err error) {
|
||||||
}
|
}
|
||||||
srcs := []string{src}
|
srcs := []string{src}
|
||||||
|
|
||||||
p := load.GoFilesPackage(context.TODO(), srcs)
|
p := load.GoFilesPackage(context.TODO(), load.PackageOpts{}, srcs)
|
||||||
|
|
||||||
if _, _, e := BuildToolchain.gc(b, &Action{Mode: "swigDoIntSize", Package: p, Objdir: objdir}, "", nil, nil, "", false, srcs); e != nil {
|
if _, _, e := BuildToolchain.gc(b, &Action{Mode: "swigDoIntSize", Package: p, Objdir: objdir}, "", nil, nil, "", false, srcs); e != nil {
|
||||||
return "32", nil
|
return "32", nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue