From 6ac40051d3eee124e8c2d2ad93c518034944a1d4 Mon Sep 17 00:00:00 2001 From: Ian Alexander Date: Thu, 9 Oct 2025 22:38:37 -0400 Subject: [PATCH] cmd/go: remove module loader state from ccompile 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob --- src/cmd/go/internal/work/exec.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 7e571c6efb..0c9e96aebb 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -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) } } -- 2.52.0