stk.Push(path)
defer stk.Pop()
+ pkgPath := p.ImportPath
+ if p.Internal.CmdlineFiles {
+ pkgPath = "command-line-arguments"
+ }
+ if cfg.ModulesEnabled {
+ p.Module = modload.PackageModuleInfo(ctx, pkgPath)
+ }
+
p.EmbedFiles, p.Internal.Embed, err = resolveEmbed(p.Dir, p.EmbedPatterns)
if err != nil {
p.Incomplete = true
p.Internal.Imports = imports
p.collectDeps()
+ if cfg.ModulesEnabled && p.Error == nil && p.Name == "main" && len(p.DepsErrors) == 0 {
+ p.Internal.BuildInfo = modload.PackageBuildInfo(pkgPath, p.Deps)
+ }
+
// unsafe is a fake package.
if p.Standard && (p.ImportPath == "unsafe" || cfg.BuildContext.Compiler == "gccgo") {
p.Target = ""
setError(fmt.Errorf("Fortran source files not allowed when not using cgo or SWIG: %s", strings.Join(p.FFiles, " ")))
return
}
-
- if cfg.ModulesEnabled && p.Error == nil {
- mainPath := p.ImportPath
- if p.Internal.CmdlineFiles {
- mainPath = "command-line-arguments"
- }
- p.Module = modload.PackageModuleInfo(ctx, mainPath)
- if p.Name == "main" && len(p.DepsErrors) == 0 {
- p.Internal.BuildInfo = modload.PackageBuildInfo(mainPath, p.Deps)
- }
- }
}
// An EmbedError indicates a problem with a go:embed directive.