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`.
  • Loading branch information
Ma27 committed Dec 23, 2020
1 parent 5a26fb3 commit b33b086
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkgs/servers/monitoring/prometheus/default.nix
Original file line number Diff line number Diff line change
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 b33b086

Please sign in to comment.