]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: remove module loader state from ccompile
authorIan Alexander <jitsu@google.com>
Fri, 10 Oct 2025 02:38:37 +0000 (22:38 -0400)
committerIan Alexander <jitsu@google.com>
Fri, 24 Oct 2025 14:21:55 +0000 (07:21 -0700)
This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Iff90d83b440b39df3d598f5a999e270baa893e24
Reviewed-on: https://go-review.googlesource.com/c/go/+/711134
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
src/cmd/go/internal/work/exec.go

index 7e571c6efbd26a19207d563f9afb416ce0c769a9..0c9e96aebbf080ddedc80a11f0b296e5406dbfa9 100644 (file)
@@ -2193,7 +2193,7 @@ func (noToolchain) cc(b *Builder, a *Action, ofile, cfile string) error {
 // gcc runs the gcc C compiler to create an object from a single C file.
 func (b *Builder) gcc(a *Action, workdir, out string, flags []string, cfile string) error {
        p := a.Package
-       return b.ccompile(modload.LoaderState, a, out, flags, cfile, b.GccCmd(p.Dir, workdir))
+       return b.ccompile(a, out, flags, cfile, b.GccCmd(p.Dir, workdir))
 }
 
 // gas runs the gcc c compiler to create an object file from a single C assembly file.
@@ -2207,23 +2207,23 @@ func (b *Builder) gas(a *Action, workdir, out string, flags []string, sfile stri
                        return fmt.Errorf("package using cgo has Go assembly file %s", sfile)
                }
        }
-       return b.ccompile(modload.LoaderState, a, out, flags, sfile, b.GccCmd(p.Dir, workdir))
+       return b.ccompile(a, out, flags, sfile, b.GccCmd(p.Dir, workdir))
 }
 
 // gxx runs the g++ C++ compiler to create an object from a single C++ file.
 func (b *Builder) gxx(a *Action, workdir, out string, flags []string, cxxfile string) error {
        p := a.Package
-       return b.ccompile(modload.LoaderState, a, out, flags, cxxfile, b.GxxCmd(p.Dir, workdir))
+       return b.ccompile(a, out, flags, cxxfile, b.GxxCmd(p.Dir, workdir))
 }
 
 // gfortran runs the gfortran Fortran compiler to create an object from a single Fortran file.
 func (b *Builder) gfortran(a *Action, workdir, out string, flags []string, ffile string) error {
        p := a.Package
-       return b.ccompile(modload.LoaderState, a, out, flags, ffile, b.gfortranCmd(p.Dir, workdir))
+       return b.ccompile(a, out, flags, ffile, b.gfortranCmd(p.Dir, workdir))
 }
 
 // ccompile runs the given C or C++ compiler and creates an object from a single source file.
-func (b *Builder) ccompile(loaderstate *modload.State, a *Action, outfile string, flags []string, file string, compiler []string) error {
+func (b *Builder) ccompile(a *Action, outfile string, flags []string, file string, compiler []string) error {
        p := a.Package
        sh := b.Shell(a)
        file = mkAbs(p.Dir, file)
@@ -2310,7 +2310,7 @@ func (b *Builder) ccompile(loaderstate *modload.State, a *Action, outfile string
                        }
                }
                if len(newFlags) < len(flags) {
-                       return b.ccompile(loaderstate, a, outfile, newFlags, file, compiler)
+                       return b.ccompile(a, outfile, newFlags, file, compiler)
                }
        }