-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: provide package path for main packages to cmd/compile #34480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @cherrymui |
The compiler uses myimportpath for symbol names and such. But as you said we can rewrite it to "main" as necessary. So either option will work for this use case. I'm slightly inclined to option 2, for an option specific for benchmarking. User could also overwrite it if necessary. |
For option 1, a binary may have multiple packages named For option 2, would you want to use this for import paths (strings that appear in |
That makes sense.
Perhaps cmd/go could provide
Hm, so I want that when I run "go build [pkgs...]", that each individual compile operation has some unique stable identifier so I can correlate benchmarks across builds. That makes me think we actually want the resolved package path, which then also means we can't always rely on -p even for non-main packages. |
Would this still be helpful? |
It may still be helpful, but not urgent. There workarounds, e.g. using a script to build one main package a time. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
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: