Skip to content

Commit

Permalink
Use ldflags to set version and commitSha
Browse files Browse the repository at this point in the history
  • Loading branch information
knightpp committed Jul 31, 2023
1 parent c465294 commit 59bc5a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@
name = "modupdate";
path = ./.;
};
gitRev = if (self ? rev) then self.rev else "dirty";
modupdate = pkgs.buildGoModule {
name = "modupdate";
src = pkgs.nix-gitignore.gitignoreSource [ ] path;
vendorSha256 = "sha256-XU4kLbEAPCL8mNk4omk2OIijKdiiAsJKBfoKkJJfHkI=";

ldflags = [ "-s" "-w" ];
ldflags = [
"-s"
"-w"
"-X 'main.version=${self.shortRev or ""}'"
"-X 'main.vcsCommit=${gitRev}'"
];

meta = with pkgs.lib; {
description = "Tool to update direct dependencies in go.mod";
Expand Down

0 comments on commit 59bc5a9

Please sign in to comment.