// buildmodeShared takes the "go build" action a1 into the building of a shared library of a1.Deps.
// That is, the input a1 represents "go build pkgs" and the result represents "go build -buildmode=shared pkgs".
-func (b *Builder) buildmodeShared(mode, depMode BuildMode, args []string, pkgs []*load.Package, a1 *Action) *Action {
+func (b *Builder) buildmodeShared(loaderstate *modload.State, mode, depMode BuildMode, args []string, pkgs []*load.Package, a1 *Action) *Action {
name, err := libname(args, pkgs)
if err != nil {
base.Fatalf("%v", err)
}
- return b.linkSharedAction(modload.LoaderState, mode, depMode, name, a1)
+ return b.linkSharedAction(loaderstate, mode, depMode, name, a1)
}
// linkSharedAction takes a grouping action a1 corresponding to a list of built packages
a.Deps = append(a.Deps, b.AutoAction(modload.LoaderState, ModeBuild, depMode, p))
}
if cfg.BuildBuildmode == "shared" {
- a = b.buildmodeShared(ModeBuild, depMode, args, pkgs, a)
+ a = b.buildmodeShared(modload.LoaderState, ModeBuild, depMode, args, pkgs, a)
}
b.Do(ctx, a)
}
// tools above did not apply, and a is just a simple Action
// with a list of Deps, one per package named in pkgs,
// the same as in runBuild.
- a = b.buildmodeShared(ModeInstall, ModeInstall, patterns, pkgs, a)
+ a = b.buildmodeShared(modload.LoaderState, ModeInstall, ModeInstall, patterns, pkgs, a)
}
b.Do(ctx, a)