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 build in modules module does not build dependencies #33496

Closed
MartinKosicky opened this issue Aug 6, 2019 · 5 comments
Closed

cmd/go: go build in modules module does not build dependencies #33496

MartinKosicky opened this issue Aug 6, 2019 · 5 comments
Labels
FrozenDueToAge modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@MartinKosicky
Copy link

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

$ go version go1.12.7 windows/amd6

Does this issue reproduce with the latest release?

Yes

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

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\martin\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\Development\Go\Test123\vendor
set GOPROXY=
set GORACE=
set GOROOT=D:\Golang
set GOTMPDIR=
set GOTOOLDIR=D:\Golang\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\Development\Go\Test123\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\martin\AppData\Local\Temp\go-build709166158=/tmp/go-build -gno-record-gcc-switches

go env Output
$ go env

What did you do?

Well this is not really a bug. I am using go modules. I think it would be very helpful if go build (when running in go modules mode) does also build the dependencies. For instance I want to use a protoc-gen-go library which is tightly coupled with the current protobuf library. I have a go.mod that specified "github.com/golang/protobuf v1.3.2" but that only downloads the runtime libraries. The compiler is stripped from the download as (I guess it's not referenced anywhere). I don't really need this kind of tidying. I know I can make a custom script that does
go get -u github.com/golang/protobuf/protoc-gen-go@v1.xxx

but that is redundant since I already specified version in go.mod.
Are there any plans for this thing???

@katiehockman katiehockman changed the title Go modules build does not build dependencies cmd/go: modules build does not build dependencies Aug 6, 2019
@katiehockman katiehockman changed the title cmd/go: modules build does not build dependencies cmd/go: go build in modules module does not build dependencies Aug 6, 2019
@bcmills
Copy link
Contributor

bcmills commented Aug 6, 2019

go build does build dependencies.

Since you mention protoc-gen-go, see https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module. Does that address your use-case here?

@bcmills
Copy link
Contributor

bcmills commented Aug 6, 2019

See also #27653.

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 6, 2019
@MartinKosicky
Copy link
Author

Well I looked at the docs. It's still annoying that I have to actually write
go install github.com/golang/protobuf/protoc-gen-go
however now the version can be omited so I don't have to track the versioning at 2 different places (go.mod and some build script). However I think this will suffice

@MartinKosicky
Copy link
Author

Ur right this totally fixes my issues. Thank you!

@agnivade
Copy link
Contributor

agnivade commented Aug 7, 2019

Thanks @MartinKosicky, I will close this then.

@agnivade agnivade closed this as completed Aug 7, 2019
@golang golang locked and limited conversation to collaborators Aug 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants