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

cmd/go: build does not allow for assembly output to be displayed on cached builds #23877

Closed
dlsniper opened this issue Feb 16, 2018 · 12 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dlsniper
Copy link
Contributor

dlsniper commented Feb 16, 2018

What version of Go are you using (go version)?

go version go1.10 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Windows 10 / amd64

What did you do?

Ran go build -gcflags -S file.go twice on a file that did not changed.

What did you expect to see?

The assembly output should be displayed twice.

What did you see instead?

First time this works, second time this doesn't because of the caching. I understand why this happens but I don't particularly like the effect it has or the workaround, especially since on Windows it's still not trivial to run the workaround as is on other operating systems.

The workaround is: GODEBUG=gocacheverify=1 go build -gcflags -S file.go.

My apologies for finding this so late.

@bradfitz bradfitz added this to the Go1.10.1 milestone Feb 16, 2018
@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 16, 2018
@bradfitz
Copy link
Contributor

Yeah, we can probably disable caching for all such debug/printing flags. Want to make a list of them all?

@dlsniper
Copy link
Contributor Author

I'm not sure if disabling the cache for the build or caching the output is the correct way to go forward.

I'll collect these in the issue and ping after it's done (should be this weeked).

@bradfitz
Copy link
Contributor

bradfitz commented Feb 16, 2018

Considering how rarely these are used, and how they're only used for debugging or developing the Go compilers themselves, disabling the build cache seems simplest and safest.

@dominikh
Copy link
Member

Considering how rarely these are used, and how they're only used for debugging or developing the Go compilers themselves

Neither of these statements are true. People use -S and -m for performance analysis of their own code.

@bradfitz
Copy link
Contributor

I mean they're only used for
a) debugging
b) developing the Go compilers themselves
sure, we can add
c) performance analysis of your own code

My point remains: they're rarely used.

We can afford to give up the caching here.

@ALTree
Copy link
Member

ALTree commented Feb 16, 2018

Another workaround is using go tool compile -S, that will always print the asm. It's also 2 characters shorter than go build -gcflags -S, so you save time : )

@FiloSottile
Copy link
Contributor

FiloSottile commented Apr 24, 2018

@gopherbot please open a backport tracking issue, as this is a 1.10 regression.

@gopherbot
Copy link

Backport issue(s) opened: #25045 (for 1.10).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@rsc
Copy link
Contributor

rsc commented May 25, 2018

No flag whitelist needed. This is a variant of #22587. https://golang.org/cl/77110 should have fixed this but somehow did not.

/cc @bcmills want to take a look?

@bcmills
Copy link
Contributor

bcmills commented May 25, 2018

I'll look into it when I get a chance. Is this possibly a difference of stderr vs. stdout?

@ianlancetaylor
Copy link
Contributor

In my testing the -S output is repeated as expected when building a non-main package. It is not repeated when building a main package if the executable already exists.

@dlsniper Were you building a main package?

@gopherbot
Copy link

Change https://golang.org/cl/128903 mentions this issue: cmd/go: display cached compiler output more often

@golang golang locked and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

10 participants