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 -v outputs nothing while changing the resulting binary #24214

Closed
Luit opened this issue Mar 2, 2018 · 4 comments
Closed

cmd/go: build -v outputs nothing while changing the resulting binary #24214

Luit opened this issue Mar 2, 2018 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@Luit
Copy link

Luit commented Mar 2, 2018

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

go version go1.10 linux/amd64

Does this issue reproduce with the latest release?

Yes (1.10 is latest, to my knowledge)

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

GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOARCH="amd64"
GOOS="linux"

What did you do?

Comparing Go 1.9 and 1.10 (using Docker), I do the following:

  1. In a folder (/home/test in this case) create a main.go containing the bare minimum:

    package main
    
    func main() {}
    
  2. Run go build

  3. Create test.go containing something visible:

    package main
    
    import "fmt"
    
    func init() {
            fmt.Println("test")
    }
    
  4. Run go build

  5. Remove test.go and run go build -v

What did you expect to see?

I expected the same output as I get from Go 1.9

root@b549b4931373:/home/test# go version
go version go1.9.4 linux/amd64
root@b549b4931373:/home/test# ./test
test
root@b549b4931373:/home/test# rm ./test.go
root@b549b4931373:/home/test# go build -v
_/home/test
root@b549b4931373:/home/test# ./test
root@b549b4931373:/home/test# 

What did you see instead?

Instead, go build -v outputs nothing, but the resulting binary did actually change.

root@3f5a7744d3ef:/home/test# go version
go version go1.10 linux/amd64
root@3f5a7744d3ef:/home/test# ./test
test
root@3f5a7744d3ef:/home/test# rm ./test.go
root@3f5a7744d3ef:/home/test# go build -v
root@3f5a7744d3ef:/home/test# ./test
root@3f5a7744d3ef:/home/test# 

I created this test case after go get -v showed this behavior for me, so I expect build, install and get to all be affected by this.

@andybons
Copy link
Member

/cc @ianlancetaylor

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 13, 2018
@andybons andybons added this to the Go1.11 milestone Mar 26, 2018
@andybons
Copy link
Member

@rsc

@gopherbot
Copy link

Change https://golang.org/cl/107937 mentions this issue: cmd/go: when updating time on cached executable, with -v, print path

@ianlancetaylor
Copy link
Contributor

The -v option is documented as printing the package when it is compiled. In your case, the package is cached. It is not being recompiled. The go tool updates the modification time to partially hide the detail that the package was cached. But since the package was not recompiled, it is not printed by -v.

@golang golang locked and limited conversation to collaborators Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants