Skip to content

Commit c45edd2

Browse files
author
Randall C. O'Reilly
committed
add -mod=mod for all go build commands -- otherwise build environment for "go mod tidy" etc is not right
1 parent 28554c6 commit c45edd2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bind/gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def Init():
338338
# %[2]s
339339
340340
GOCMD=go
341-
GOBUILD=$(GOCMD) build
341+
GOBUILD=$(GOCMD) build -mod=mod
342342
GOIMPORTS=goimports
343343
PYTHON=%[4]s
344344
LIBEXT=%[5]s
@@ -376,7 +376,7 @@ build:
376376
# %[2]s
377377
378378
GOCMD=go
379-
GOBUILD=$(GOCMD) build
379+
GOBUILD=$(GOCMD) build -mod=mod
380380
GOIMPORTS=goimports
381381
PYTHON=%[4]s
382382
LIBEXT=%[5]s

cmd_build.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func runBuild(mode bind.BuildMode, cfg *BuildCfg) error {
127127
cmd = exec.Command(cfg.VM, "build.py")
128128
cmd.Run() // will fail, we don't care about errors
129129

130-
args := []string{"build", "-buildmode=c-shared", "-o", buildname + libExt, "."}
130+
args := []string{"build", "-mod=mod", "-buildmode=c-shared", "-o", buildname + libExt, "."}
131131
fmt.Printf("go %v\n", strings.Join(args, " "))
132132
cmd = exec.Command("go", args...)
133133
cmdout, err = cmd.CombinedOutput()
@@ -147,7 +147,7 @@ func runBuild(mode bind.BuildMode, cfg *BuildCfg) error {
147147
err = os.Remove(cfg.Name + "_go" + libExt)
148148

149149
fmt.Printf("go build -o py%s\n", cfg.Name)
150-
cmd = exec.Command("go", "build", "-o", "py"+cfg.Name)
150+
cmd = exec.Command("go", "build", "-mod=mod", "-o", "py"+cfg.Name)
151151
cmdout, err = cmd.CombinedOutput()
152152
if err != nil {
153153
fmt.Printf("cmd had error: %v output:\n%v\n", err, string(cmdout))
@@ -167,7 +167,7 @@ func runBuild(mode bind.BuildMode, cfg *BuildCfg) error {
167167

168168
// build the go shared library upfront to generate the header
169169
// needed by our generated cpython code
170-
args := []string{"build", "-buildmode=c-shared"}
170+
args := []string{"build", "-mod=mod", "-buildmode=c-shared"}
171171
if !cfg.Symbols {
172172
// These flags will omit the various symbol tables, thereby
173173
// reducing the final size of the binary. From https://golang.org/cmd/link/

0 commit comments

Comments
 (0)