golang/go

cmd/go: revise build stamp keys for Go 1.18

bcmills opened this issue · 8 comments

In #37475 (comment), @mpx notes that the keys used to record build stamp information are a bit inconsistent: we currently use gitrevision, hgrevision, etc. for each vcs, and uncommitted for all VCSs.

I discussed with @rsc and @matloob, and we are planning to revise these setting-names both to make the VCS settings a bit more uniform and to more clearly distinguish between flags and other metadata. (@rsc may do this as a further patch-set on CL 358539.)

mpx commented

To clarify: We always prepend the VCS name before revision, uncommitted, and committime. I think it would be better to set a vcs tag and stop prepending the name to other keys. committime and uncommitted (even revision) are basically the same across VCS, and using consistent names makes them much easier to consume. It's unlikely we ever want to support simultaneously tagging for multiple VCS.

This is mostly done in CL 358539, but it needs a test-fix before it can be merged.

The beta is getting close and this is currently marked as blocking the beta. Any news here?

Hi @heschi, FWIW, CL 358539 was merged earlier today.

I just ran this against gotip and didn't see the VCS stuff:

	info, ok := debug.ReadBuildInfo()
	if !ok {
		return
	}
	fmt.Println(info.Settings)
$ gotip version
go version devel go1.18-7ccbcc9056 Tue Nov 30 20:04:58 2021 +0000 darwin/amd64
$ gotip run test_run.go
[{-compiler gc} {CGO_ENABLED 1} {CGO_CFLAGS } {CGO_CPPFLAGS } {CGO_CXXFLAGS } {CGO_LDFLAGS } {GOARCH amd64} {GOOS darwin} {GOAMD64 v1}]

Is that still pending a CL?

This specific issue is fixed by CL 358539.

@carlmjohnson, if you are missing VCS stamps when you expect them, please open a new issue with details and/or steps to reproduce. (I suspect that what you're seeing may have something to do with module/repo boundaries..?)

Change https://golang.org/cl/369743 mentions this issue: cmd/go: fix tests broken in CL 358539

Change https://golang.org/cl/378575 mentions this issue: cmd/go: fix TestScript/version_buildvcs_git_gpg