Skip to content
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

x/tools/go/packages: lists PGO variants of the unsafe package #60456

Closed
findleyr opened this issue May 26, 2023 · 4 comments
Closed

x/tools/go/packages: lists PGO variants of the unsafe package #60456

findleyr opened this issue May 26, 2023 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented May 26, 2023

When loading the cmd module, go/packages synthesizes an intermediate test variantpgo variant for the 'unsafe' package. This doesn't make sense, since the unsafe package has no imports. Intermediate test variants exist to remap imports.

> gopackages -deps cmd/... | grep "unsafe "
Go package "unsafe [cmd/compile]":
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"
	import "unsafe" => "unsafe [cmd/compile]"

CC @matloob @adonovan @bcmills

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label May 26, 2023
@gopherbot gopherbot added this to the Unreleased milestone May 26, 2023
@bcmills
Copy link
Contributor

bcmills commented May 26, 2023

Those aren't test variants — those are PGO variants (attn @cherrymui @prattmic).

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 26, 2023
@findleyr
Copy link
Contributor Author

I see. I feel like go/packages should probably filter these out? This could be problematic for many tools.

@findleyr findleyr changed the title x/tools/go/packages: synthesizes test variant of the unsafe package x/tools/go/packages: lists PGO variants of the unsafe package May 26, 2023
@findleyr
Copy link
Contributor Author

Per discussion, I think we should set -pgo=off by default (especially in light of the performance cost, e.g. #60455). If someone wants to file a proposal to add a NeedPGO flag, they can, but I don't see a reason why users of go/packages would care about PGO variants.

CC @dominikh

@gopherbot
Copy link

Change https://go.dev/cl/498557 mentions this issue: go/packages: pass -pgo=off on go1.21 and later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants