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: "go test" seems to now require git due to -buildvcs [1.18 backport] #51767

Closed
gopherbot opened this issue Mar 17, 2022 · 2 comments
Closed
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge GoCommand cmd/go
Milestone

Comments

@gopherbot
Copy link

@bcmills requested issue #51723 to be considered for backport to the next 1.18 minor release.

@gopherbot, please backport to Go 1.18. Invoking git for each go test of a package main is surprising and wastes users' time and battery power.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Mar 17, 2022
@gopherbot gopherbot added this to the Go1.18.1 milestone Mar 17, 2022
@bcmills bcmills added the CherryPickApproved Used during the release process for point releases label Mar 18, 2022
@gopherbot
Copy link
Author

Change https://go.dev/cl/393878 mentions this issue: [release-branch.go1.18] cmd/go: avoid stamping VCS metadata in test binaries

@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Mar 18, 2022
zrma added a commit to zrma/1d1go that referenced this issue Mar 19, 2022
…t requires git due to -buildvcs" backport

- golang/go#51767
- golang/go#51723

> @bcmills requested issue #51723 to be considered for backport to the next 1.18 minor release.
>
> @gopherbot, please backport to Go 1.18. Invoking git for each go test of a package main is surprising and wastes users' time and battery power.
zrma added a commit to zrma/1d1go that referenced this issue Mar 19, 2022
…ving "go test requires git due to -buildvcs" backport

- golang/go#51767
- golang/go#51723

> @bcmills requested issue #51723 to be considered for backport to the next 1.18 minor release.
>
> @gopherbot, please backport to Go 1.18. Invoking git for each go test of a package main is surprising and wastes users' time and battery power.
zrma added a commit to zrma/1d1go that referenced this issue Mar 19, 2022
… requires git due to -buildvcs" backport

- golang/go#51767
- golang/go#51723

> @bcmills requested issue #51723 to be considered for backport to the next 1.18 minor release.
>
> @gopherbot, please backport to Go 1.18. Invoking git for each go test of a package main is surprising and wastes users' time and battery power.
@gopherbot
Copy link
Author

Closed by merging d17c573 to release-branch.go1.18.

gopherbot pushed a commit that referenced this issue Apr 4, 2022
…inaries

Invoking a VCS tool requires that the VCS tool be installed, and also
adds latency to build commands. Unfortunately, we had been mistakenly
loading VCS metadata for tests of "main" packages.

Users almost never care about versioning for test binaries, because
'go test' runs the test in the source tree and test binaries are only
rarely used outside of 'go test'. So the user already knows exactly
which version the test is built against, because the source code is
right there — it's not worth the overhead to stamp.

Fixes #51767.
Updates #51723.

Change-Id: I96f191c5a765f5183e5e10b6dfb75a0381c99814
Reviewed-on: https://go-review.googlesource.com/c/go/+/393894
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 67f6b8c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/393878
Reviewed-by: Cherry Mui <cherryyz@google.com>
@cherrymui cherrymui added the GoCommand cmd/go label Apr 6, 2022
jfkw added a commit to jfkw/connect-ng that referenced this issue Apr 12, 2022
* go1.18+ detects VCS e.g. .git in sources
  https://go.dev/doc/go1.18#go-version

* Default behavior -buildvcs=auto calls git to embed build info

* VCS detection has effect of runtime soft dependency on git

* Suppress in each RPM build section before go tool use

* export GOFLAGS="-buildvcs=false" in RPM spec %build (go build)
  and %check (gotest) sections

* go test will revert to buildvcs off behaviour in go1.18.1 per
  golang/go#51767
  https://go-review.googlesource.com/c/go/+/393878/

* Alternatively add BuildRequires dependency on git

* go1.18+ 'go version -m ./binaryname' also provides build info
jfkw added a commit to jfkw/connect-ng that referenced this issue Apr 13, 2022
* go1.18+ detects VCS e.g. .git in sources
  https://go.dev/doc/go1.18#go-version

* Default behavior -buildvcs=auto calls git to embed build info

* VCS detection has effect of runtime soft dependency on git

* Suppress in each RPM build section before go tool use

* export GOFLAGS="-buildvcs=false" in RPM spec %build (go build)
  and %check (gotest) sections

* Conditionals %rpm_vercmp around exports for backward
  compatibility with versions before go1.18

* go test will revert to buildvcs off behaviour in go1.18.1 per
  golang/go#51767
  https://go-review.googlesource.com/c/go/+/393878/

* Alternatively rm .git or add BuildRequires dependency on git

* go1.18+ 'go version -m ./binaryname' also provides build info
zrma added a commit to zrma/1d1go that referenced this issue Apr 27, 2022
… requires git due to -buildvcs" backport

- golang/go#51767
- golang/go#51723

> @bcmills requested issue #51723 to be considered for backport to the next 1.18 minor release.
>
> @gopherbot, please backport to Go 1.18. Invoking git for each go test of a package main is surprising and wastes users' time and battery power.
@golang golang locked and limited conversation to collaborators Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge GoCommand cmd/go
Projects
None yet
Development

No branches or pull requests

3 participants