We used the traditional way for a long time. But with the embed package we
stopped this. This is a good blog post on the topic:
https://levelup.gitconnected.com/a-better-way-than-ldflags-to-add-a-build-version-to-your-go-binaries-2258ce419d2d
.

Am Mi., 2. Nov. 2022 um 09:54 Uhr schrieb Jakob Borg <ja...@kastelo.net>:

> On 2 Nov 2022, at 09:47, 'Mark' via golang-nuts <
> golang-nuts@googlegroups.com> wrote:
>
>
> Oh, except that debug.BuildInfo (unsurprisingly) is only available in
> debug not release builds. So I guess the answer is that there isn't any
> nice way to do it.
>
>
> What do you mean by debug vs release builds? I don't think Go makes that
> distinction.
>
> That said, the build info will not contain information about your tags and
> such. The traditional way to add that is to have a build script inject that
> using `-ldflags -X ...` to set the value of some variables in the program.
>
> //jb
>
> --
> 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/885E5726-E0CD-46B2-B572-900A2E87AE07%40kastelo.net
> <https://groups.google.com/d/msgid/golang-nuts/885E5726-E0CD-46B2-B572-900A2E87AE07%40kastelo.net?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CALWqRZpLzpVuz22WHpFeusSwm6ajx6gDHDd5r15BN_oOE7U19g%40mail.gmail.com.

Reply via email to