My team recently started using podman and the UBI9 go-toolset image to 
containerize our golang apps [1]. We found that if our Dockerfile copied 
the entire source tree in (including the .git directory), `go build` would 
fail unless we set the `-buildvcs=false` flag [2].

Since this wasn't happening on my local machine (Fedora 39), I tried to 
debug further only to find a surprising lack of documentation on this 
feature. I couldn't find anything in the `go` command documentation beyond 
the short note on what the `-buildvcs` flag does [3]. Nor could I easily 
find information on how developers can consume the VCS stamp information. 
My hope is that this feature would/could replace the `-ldflags` technique 
many golang developers have used to inject source control information into  
applications.

Is there any documentation that exists here? And for instances when 
`-buildvcs=auto|true` fails, how can developers debug and find the root 
cause?

Pertinent version information for those who want to investigate further:

Go version (in the container): go1.20.12 linux/amd64
Git version (container): 2.39.3
Podman version (Fedora 39): 
Client:       Podman Engine
Version:      4.9.4
API Version:  4.9.4
Go Version:   go1.21.8
Built:        Tue Mar 26 05:39:52 2024
OS/Arch:      linux/amd64

[1] 
https://catalog.redhat.com/software/containers/ubi9/go-toolset/61e5c00b4ec9945c18787690?q=go%20toolset&architecture=amd64&image=6627073123047dd3dc857edb
[2] https://issues.redhat.com/browse/RHEL-36097
[3] https://pkg.go.dev/cmd/go

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/21a0a261-9194-462e-8bc0-c5151543d0d8n%40googlegroups.com.

Reply via email to