Re: Golang debug/buildinfo

From: Ben Lavery-Griffiths <ben_at_lavery-griffiths.com>
Date: Sat, 28 May 2022 07:47:45 UTC
Hi Dmitri,

Many thanks for your reply.  I shall take a look to see how others have packaged this on other platforms  and take a lead from there for now.  I'll also raise this with upstream as they usually have an opinion on packaging and may not have considered this.

Thanks again!
Ben

On Sat, 28 May 2022, at 01:03, Dmitri Goutnik wrote:
> Hi Ben,
> 
> On 22-05-27 22:31:52, Ben Lavery-Griffiths wrote:
> > Hey all,
> > 
> > I maintain the www/gohugo port, with the upgrade to Go 1.18 they project has switched to using debug/buildinfo (https://pkg.go.dev/runtime/debug#BuildInfo), this gets certain information from VCS, as opposed to passing the values in via ldflags.
> > 
> > Presuming more and more Go projects will use this mechanism, does anyone know how we will be dealing with this for building ports?
> 
> Currently, go.mk explicitly disables embedding VCS information in binaries by 
> passing -buildvcs=false flag. Embedding VCS info will not work for port builds 
> because it required git (or other VCS, depending on the repository [1]), which 
> is not available in clean build environments. Other BuildInfo data (compiler 
> version, settings etc) should be available.
> 
> In cases when upstream code is not able to handle missing VCS info, it will 
> probably need to be patched. I'd consider this situation an upstream bug as it 
> effectively prevents packaging.
> 
> [2] provides more background on this issue.
> 
> [1] https://tip.golang.org/doc/go1.18#go-version
> [2] https://github.com/golang/go/issues/51748
> 
> > Many thanks,
> > Ben
> > 
> 
> Best regards,
> 
> -- 
> Dmitri Goutnik
> dg@syrec.org / dmgk@FreeBSD.org
> 
> 
> *Attachments:*
>  * signature.asc