| 1 |
From: Anthony Fok <[email protected]> |
| 2 |
Date: Sat, 14 Oct 2023 23:24:48 -0600 |
| 3 |
Subject: Set GO111MODULE=on to fix TestExampleSeparateAnalysis |
| 4 |
|
| 5 |
Fixes the following error when GO111MODULE=off: |
| 6 |
|
| 7 |
invoke.go:265: 40.546052ms for GOROOT= GOPATH=/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu GO111MODULE=off GOPROXY=off PWD=/tmp/TestExampleSeparateAn |
| 8 |
alysis4090709764/001 go list -e -f {{context.ReleaseTags}} -- unsafe |
| 9 |
invoke.go:265: 35.954687ms for GOROOT= GOPATH=/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu GO111MODULE=off GOPROXY=off PWD=/tmp/TestExampleSeparateAn |
| 10 |
alysis4090709764/001 go list -e -json=Name,ImportPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,CgoFiles,CXXFiles,MFiles,HFiles,FF |
| 11 |
iles,SFiles,SwigFiles,SwigCXXFiles,SysoFiles,CompiledGoFiles,Export,DepOnly,Imports,ImportMap,Module -compiled=true -test=false -export=false -dep |
| 12 |
s=true -find=false -pgo=off -- separate/main |
| 13 |
-: cannot find package "separate/main" in any of: |
| 14 |
/usr/lib/go-1.21/src/separate/main (from $GOROOT) |
| 15 |
/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/src/separate/main (from $GOPATH) |
| 16 |
separate_test.go:105: there were errors among loaded packages |
| 17 |
--- |
| 18 |
go/analysis/unitchecker/separate_test.go | 1 + |
| 19 |
1 file changed, 1 insertion(+) |
| 20 |
|
| 21 |
diff --git a/go/analysis/unitchecker/separate_test.go b/go/analysis/unitchecker/separate_test.go |
| 22 |
index 2198154..4ac3ee7 100644 |
| 23 |
--- a/go/analysis/unitchecker/separate_test.go |
| 24 |
+++ b/go/analysis/unitchecker/separate_test.go |
| 25 |
@@ -94,6 +94,7 @@ func MyPrintf(format string, args ...any) { |
| 26 |
Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports | packages.NeedModule, |
| 27 |
Dir: tmpdir, |
| 28 |
Env: append(os.Environ(), |
| 29 |
+ "GO111MODULE=on", // needs Go module to work |
| 30 |
"GOPROXY=off", // disable network |
| 31 |
"GOWORK=off", // an ambient GOWORK value would break package loading |
| 32 |
), |