Merge pull request #134925 from qowoz/go-buildflags

This commit is contained in:
Sandro 2021-08-20 12:40:34 +02:00 committed by GitHub
commit 57547596b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 22 deletions

View File

@ -17,7 +17,7 @@ buildGoPackage rec {
export CGO_CFLAGS=-I$(pwd)/go/src/${goPackagePath}/vendor/github.com/jceel/lib9p
export CGO_LDFLAGS=$(pwd)/go/src/${goPackagePath}/vendor/build/lib9p/lib9p.a
'';
buildFlags = "--tags lib9p";
tags = [ "lib9p" ];
src = fetchFromGitHub {
rev = "v${version}";

View File

@ -20,13 +20,13 @@ buildGoModule rec {
subPackages = ["cmd"];
preBuild = ''
export buildFlagsArray+=("-ldflags=-X main.kubeBuilderVersion=v${version} \
-X main.goos=$GOOS \
-X main.goarch=$GOARCH \
-X main.gitCommit=v${version} \
-X main.buildDate=v${version}")
'';
ldflags = [
"-X main.kubeBuilderVersion=v${version}"
"-X main.goos=${go.GOOS}"
"-X main.goarch=${go.GOARCH}"
"-X main.gitCommit=v${version}"
"-X main.buildDate=v${version}"
];
doCheck = true;

View File

@ -33,9 +33,9 @@ buildGoPackage rec {
sha256 = "0syv9md7blnl6i19zf8s1xjx5vfz6s755fxyg2ply0qc1pwhsj8n";
};
preBuild = ''
buildFlagsArray=("-ldflags=-X ${goPackagePath}/version.Version=${version}")
'';
ldflags = [
"-X ${goPackagePath}/version.Version=${version}"
];
meta = with lib; {
description = "Golang terminal emulator from scratch";

View File

@ -11,12 +11,10 @@ buildGoModule rec {
sha256 = "1a0xi31bd7n2zrx2z4srhvixlbj028h63dlrjzqxgmgn2w6akbz2";
};
preBuild = ''
export buildFlagsArray+=(
"-ldflags=
-w -s
-X github.com/jlesquembre/kubeprompt/pkg/version.Version=${version}")
'';
ldflags = [
"-w" "-s"
"-X github.com/jlesquembre/kubeprompt/pkg/version.Version=${version}"
];
vendorSha256 = "089lfkvyf00f05kkmr935jbrddf2c0v7m2356whqnz7ad6a2whsi";

View File

@ -17,11 +17,9 @@ buildGoModule rec {
sed "s;/templates/default.tmpl;$out/share&;" -i cmd/alertmanager-bot/main.go
'';
preBuild = ''
export buildFlagsArray=(
"-ldflags=-s -w -X main.Version=v${version} -X main.Revision=${src.rev}"
)
'';
ldflags = [
"-s" "-w" "-X main.Version=v${version}" "-X main.Revision=${src.rev}"
];
postInstall = ''
install -Dm644 -t $out/share/templates $src/default.tmpl