Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Nov 2016 15:13:20 -0500
From:      Vick Khera <vivek@khera.org>
To:        FreeBSD Ports List <ports@freebsd.org>
Subject:   how to pass "-ldflags" to a go language build.
Message-ID:  <CALd%2BdceE5M0DSh%2BSQQ42OEdK=rtspCCnWcWH91Szb2KBXD2-YA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I'm looking at the port for net-mgmt/telegraf to see if we can have it
bake in the version number into the binary. Right now when you run
"telegraf -version" it just says literally "version". Apparently the
right way to set their version is to pass it to the command line like
this:

 go build -ldflags "-X main.version=$DISTVERSION" ...

How can I convince the Go ports infrastructure to pass this flag to
the right place? I don't see any obvious way in the Uses/go.mk file.

Similarly, the databases/influxdb port could use this treatment, so it
shows what version it is when you connect to it.

Thanks!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALd%2BdceE5M0DSh%2BSQQ42OEdK=rtspCCnWcWH91Szb2KBXD2-YA>