cmd/go: provide package path for main packages to cmd/compile #34480
Labels
FeatureRequest
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Can cmd/go provide cmd/compile with the full package path to the source package, even when compiling main packages?
When benchmarking cmd/compile changes, it's useful to key stuff by
myimportpath
(i.e., the-p
command-line flag) and just spit everything across an entire "go build -a std cmd" build into a single file, and then letbenchcmp
orbenchstat
handle it.But this currently doesn't work for main packages, because cmd/go sets
-p main
for these:go/src/cmd/go/internal/work/gc.go
Lines 50 to 56 in 7eef0ca
So you end up with a bunch of "BenchmarkFoo:main" lines, which muddle the benchcmp/benchstat output.
I figure two main options:
Change cmd/go to just set
-p
to the package path regardless, and cmd/compile can rewrite it to"main"
where/if necessary. (Looking briefly atmyimportpath
, some uses would be unaffected; but DWARF and the new ABI stuff might be impacted.)Add another command-line flag for cmd/go to provide the package path, which cmd/compile can use for tagging benchmarking data with instead.
/cc @rsc @aclements
The text was updated successfully, but these errors were encountered: