go: x/tools/go/ssa: CreateTestMainPackage broken by fuzzing changes
~/x/tools$ gotip version
go version devel go1.18-051df0d72 Wed Sep 22 03:45:00 2021 +0000 linux/amd64
~/x/tools$ gotip test ./go/pointer
Entering directory `/usr/local/google/home/bcmills/x/tools/go/pointer'
Entering directory `/usr/local/google/home/bcmills/x/tools/go/pointer'
2021/09/22 11:06:56 internal error type-checking main$testmain: main$testmain.go:43:59: not enough arguments in call to testing.MainStart
FAIL golang.org/x/tools/go/pointer 2.067s
FAIL
That failure comes from here:
log.Fatalf("internal error type-checking %s: %v", path, err)
This function is a known technical debt:
// TODO(adonovan): throws this all away now that x/tools/go/packages
// provides access to the actual synthetic test main files.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (11 by maintainers)
Commits related to this issue
- go/pointer: skip tests that depend on an unstable API changed in Go 1.18 For golang/go#48547 Change-Id: I211239497c49b152504466dae963a68b0a4f5f6b Reviewed-on: https://go-review.googlesource.com/c/to... — committed to golang/tools by bcmills 3 years ago
- go/pointer: skip TestInput on 32-bit platforms This test was already memory-hungry to begin with, and apparently the switch to go/packages in CL 356513 pushed it over the edge of the 32-bit address s... — committed to golang/tools by bcmills 3 years ago
- cmd/guru: remove use of deprecated ssa.CreateTestMainPackage For golang/go#48547 Change-Id: I71f061e55d52c45346d34d05ade9c82e9856d6e7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/363655... — committed to golang/tools by zpavlinovic 3 years ago
- go/pointer: remove use of deprecated ssa.CreateTestMainPackage For golang/go#48547 Change-Id: Ief1c4fb6302437a8736d52e87541f8229b02289a Reviewed-on: https://go-review.googlesource.com/c/tools/+/3636... — committed to golang/tools by zpavlinovic 3 years ago
- go/ssa: remove deprecated FindTests and CreateTestMainPackage For golang/go#48547 Change-Id: I1337b99c90ce81b58dfaa93e49c6dcb884330b22 Reviewed-on: https://go-review.googlesource.com/c/tools/+/36365... — committed to golang/tools by zpavlinovic 3 years ago
This is the best option I think. Depending on an unstable API makes it unnecessarily difficult to make changes like this.
Yep! Per https://pkg.go.dev/golang.org/x/tools/go/ssa#Program.CreateTestMainPackage: “Deprecated: Use golang.org/x/tools/go/packages to access synthetic testmain packages.”
That is exactly the “switching
x/tools/go/ssato usex/tools/go/packages” option, I think. 🙂Either approach is ok by me.
I am still working on removing usage of this API from guru, which will hopefully allow us to delete this API altogether.
However, this particular issue might be interpreted as being concerned with ssa only. If that is the case, then we can close this issue and I can open another issue for tracking the progress of getting rid of this API.