-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: setting GODEBUG=*trace=1 during go build causes the printed output to be cached for future builds #41973
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
This is odd because inittrace is purely a runtime thing it should not effect the build process. Can you reproduce the behaviour with 'gctrace' too? What might happen is that stdout somehow gets mixed into some permanent build output but that would be a general problem. |
I guess it caches the inittrace of the compiler/assembler/linker. #27628 should address this. |
Yep, same thing happens with gctrace. Repeating my steps again:
So this isn't just restricted to the new inittrace. |
I ran the commands from above starting with a clean 'go get golang.org/dl/gotip' and then 'gotip download' and then the sequence of above commands posted and I can not reproduce the problem on a toy hello world program on darwin. Not sure how complex the program is gotip build is compiling but can you reproduce this with a toy hello world program? It might be that some more sophisticated part of the toolchain somehow includes standard error into some build artifact. Maybe its just the linker as cherrymui points out. Not sure how we can check its the same issue and fixing #27628 will also fix your specific case. |
All of the packages printed in the second Try this reproducer: package main
import (
"fmt"
"rsc.io/quote/v3"
)
func main() {
fmt.Println(quote.GoV3())
} Running my steps above, the last |
ack. can reproduce this way. |
Duplicate of #27628. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
On tip, yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I was trying out the new
GODEBUG=inittrace=1
support, so I ranGODEBUG=inittrace=1 gotip build
. This was probably a mistake; I really just wanted to test it on the output binary. No problem, I just ran the resulting binary with the option instead and saw the output I wanted.Later, I ran
gotip build
again.What did you expect to see?
A blank output.
What did you see instead?
I was surprised to see that the init tracing was still enabled, even though I didn't have GODEBUG set in my environment. The packages being listed were the packages I had previously built.
It seems like this option might be missing from a cache hash somewhere. Clearing the build cache (or updating gotip) fixes the issue. But, I've read the CL, and it doesn't seem to modify the compiler in any way, so I have no idea what's going on.
@martisch
The text was updated successfully, but these errors were encountered: