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: record -mod=vendor in buildinfo #57782

Open
seankhliao opened this issue Jan 13, 2023 · 2 comments
Open

cmd/go: record -mod=vendor in buildinfo #57782

seankhliao opened this issue Jan 13, 2023 · 2 comments
Labels
GoCommand cmd/go help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@seankhliao
Copy link
Member

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

$ go version
go version devel go1.20-245e95dfabd Wed Jan 11 22:29:34 2023 +0000 linux/amd64

Does this issue reproduce with the latest release?

tip

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/arccy/.cache/go-build"
GOENV="/home/arccy/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/arccy/.data/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/arccy/.data/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/arccy/sdk/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/arccy/sdk/gotip/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.20-245e95dfabd Wed Jan 11 22:29:34 2023 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/arccy/tmp/testrepo0078/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1173344524=/tmp/go-build -gno-record-gcc-switches"

What did you do?

14:47:59 ~/tmp/testrepo0078 0:00:00
main » cat go.mod 
module go.seankhliao.com/testrepo0078

go 1.20

require rsc.io/quote/v4 v4.0.1

require (
	golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
	rsc.io/sampler v1.3.0 // indirect
)

14:48:02 ~/tmp/testrepo0078 0:00:00
main » cat main.go         
package main

import (
	"fmt"

	"rsc.io/quote/v4"
)

func main() {
	fmt.Println(quote.Hello())
}

14:48:14 ~/tmp/testrepo0078 0:00:00
main » go mod vendor       

14:48:19 ~/tmp/testrepo0078 0:00:00
main » go build -mod=vendor

14:48:24 ~/tmp/testrepo0078 0:00:00
main » go version -m testrepo0078            
testrepo0078: devel go1.20-245e95dfabd Wed Jan 11 22:29:34 2023 +0000
	path	go.seankhliao.com/testrepo0078
	mod	go.seankhliao.com/testrepo0078	(devel)	
	dep	golang.org/x/text	v0.0.0-20170915032832-14c0d48ead0c	h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8=
	dep	rsc.io/quote/v4	v4.0.1	h1:i/LHLEinr65wwTCqlP4OnMoMWeCgnFIZFvifdXNK+5M=
	dep	rsc.io/sampler	v1.3.0	h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=
	build	-buildmode=exe
	build	-compiler=gc
	build	CGO_ENABLED=1
	build	CGO_CFLAGS=
	build	CGO_CPPFLAGS=
	build	CGO_CXXFLAGS=
	build	CGO_LDFLAGS=
	build	GOARCH=amd64
	build	GOOS=linux
	build	GOAMD64=v1
	build	vcs=git
	build	vcs.revision=bfd01d01b57dc4c4d2a0127ee6a38b5a3933eeb8
	build	vcs.time=2023-01-13T14:45:45Z
	build	vcs.modified=true

What did you expect to see?

usage of vendor (and/or -mod flag) recorded in build info

What did you see instead?

no difference from buildinfo built without vendor:

14:50:43 ~/tmp/testrepo0078 0:00:00
main » rm -rf vendor

14:51:07 ~/tmp/testrepo0078 0:00:00
main » go build -mod=readonly     

14:51:10 ~/tmp/testrepo0078 0:00:00
main » go version -m testrepo0078 
testrepo0078: devel go1.20-245e95dfabd Wed Jan 11 22:29:34 2023 +0000
	path	go.seankhliao.com/testrepo0078
	mod	go.seankhliao.com/testrepo0078	(devel)	
	dep	golang.org/x/text	v0.0.0-20170915032832-14c0d48ead0c	h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8=
	dep	rsc.io/quote/v4	v4.0.1	h1:i/LHLEinr65wwTCqlP4OnMoMWeCgnFIZFvifdXNK+5M=
	dep	rsc.io/sampler	v1.3.0	h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=
	build	-buildmode=exe
	build	-compiler=gc
	build	CGO_ENABLED=1
	build	CGO_CFLAGS=
	build	CGO_CPPFLAGS=
	build	CGO_CXXFLAGS=
	build	CGO_LDFLAGS=
	build	GOARCH=amd64
	build	GOOS=linux
	build	GOAMD64=v1
	build	vcs=git
	build	vcs.revision=bfd01d01b57dc4c4d2a0127ee6a38b5a3933eeb8
	build	vcs.time=2023-01-13T14:45:45Z
	build	vcs.modified=true
@seankhliao
Copy link
Member Author

cc @bcmills @matloob

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Jan 13, 2023
@bcmills
Copy link
Member

bcmills commented Jan 13, 2023

It's probably not important to distinguish -mod=readonly from -mod=mod. -mod=vendor is probably relevant, though, since folks sometimes do make modifications to the vendor directory.

@bcmills bcmills added this to the Backlog milestone Jan 17, 2023
@bcmills bcmills changed the title cmd/go: record -mod flag in buildinfo cmd/go: record -mod=vendor in buildinfo Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go help wanted 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

2 participants