Skip to content

Commit

Permalink
prometheus: gross hack to fix linker flags for versioning info
Browse files Browse the repository at this point in the history
Apparently the handling of `buildFlagsArray` in `buildGo*` is blatantly
broken since it doesn't quote flags specified as list elements properly.

Because of that, the `-ldflags` are not interpreted properly and
`prometheus --version` doesn't output anything useful. By specifying
flags in both `buildFlags` and `buildFlagsArray` the issue gets fixed
since both variables are passed to `go install`.

(cherry picked from commit b33b086)
  • Loading branch information
Ma27 authored and WilliButz committed Dec 23, 2020
1 parent 623dc82 commit 47dbb87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkgs/servers/monitoring/prometheus/default.nix
Expand Up @@ -44,10 +44,10 @@ in buildGoPackage rec {
ln -s ${webui} web/ui/static/react
'';

buildFlags = "-tags=builtinassets";
buildFlagsArray = let
t = "${goPackagePath}/vendor/github.com/prometheus/common/version";
in [
"-tags=builtinassets"
''
-ldflags=
-X ${t}.Version=${version}
Expand Down

0 comments on commit 47dbb87

Please sign in to comment.