Looking for help with kustomize port (Go)

Nils Breunese nils at breun.nl
Mon May 11 10:29:11 UTC 2020


Aaron Madlon-Kay <amake at macports.org> wrote:

> It's common in Go to specify version strings as linker flags. Grep the
> ports tree like so to see existing ports that successfully set these
> flags. It's not uncommon to use the string 'unknown' for e.g. the git
> commit when it is redundant or not readily available.
> 
> % grep -R -- "-ldflags '-X" .
> ./devel/git-sizer/Portfile:build.args              -ldflags '-X
> main.BuildVersion=${version}'
> ./devel/shfmt/Portfile:build.pre_args      -ldflags '-X main.version=${version}'
> ./security/mkcert/Portfile:build.args          -ldflags '-X
> main.Version=${version}'
> ./www/minio-mc/Portfile:      -ldflags '-X ${goproj}/cmd.Version=${relversion} \
> ./www/minio/Portfile:      -ldflags '-X ${goproj}/cmd.Version=${relversion} \
> Aarons-MBP:macports-ports amake% grep -R -- "-ldflags.*-X" .
> ./devel/git-sizer/Portfile:build.args              -ldflags '-X
> main.BuildVersion=${version}'
> ./devel/shfmt/Portfile:build.pre_args      -ldflags '-X main.version=${version}'
> ./security/mkcert/Portfile:build.args          -ldflags '-X
> main.Version=${version}'
> ./www/minio-mc/Portfile:      -ldflags '-X ${goproj}/cmd.Version=${relversion} \
> ./www/minio/Portfile:      -ldflags '-X ${goproj}/cmd.Version=${relversion} \
> ./www/caddy/Portfile:build.args          -ldflags \"-X
> ${go.package}/${name}/caddymain.gitTag=v${version}\"
> ./sysutils/go2port/Portfile:build.args          -ldflags "'-X
> main.version=${version}'"
> ./sysutils/go2port/Portfile~:build.args          -ldflags "'-X
> main.version=${version}'"
> ./sysutils/chezmoi/Portfile:build.args          -ldflags \"-X
> main.version=${version} -X main.builtBy=macports\"

Thanks. I know actually about this mechanism, but I guess I should have specified that I don’t know how to find out what the exact names of the flags are that I should set. Is there an easy way to find out? Should I go and read the source code? Or ask the developers?

Nils.



More information about the macports-dev mailing list