yamlfmt: correct commit reference in version flag

This commit is contained in:
Kenichi Kamiya
2025-08-03 19:58:14 +09:00
parent 013a936cac
commit 699af90c19
+10 -2
View File
@@ -14,7 +14,12 @@ buildGoModule (finalAttrs: {
owner = "google";
repo = "yamlfmt";
tag = "v${finalAttrs.version}";
hash = "sha256-EYOtxb2Xq4bQpWbITmPieVMqJz3/2chgNirZEjiyjAY=";
hash = "sha256-WSw4WhWNyvkCwRCQYFAKhtkvOSSCrSlX3+i6cMHRtOQ=";
leaveDotGit = true;
postFetch = ''
git -C "$out" rev-parse --short HEAD > "$out/.git_head"
rm -rf "$out/.git"
'';
};
vendorHash = "sha256-Cy1eBvKkQ90twxjRL2bHTk1qNFLQ22uFrOgHKmnoUIQ=";
@@ -23,9 +28,12 @@ buildGoModule (finalAttrs: {
"-s"
"-w"
"-X=main.version=${finalAttrs.version}"
"-X=main.commit=${finalAttrs.src.rev}"
];
preBuild = ''
ldflags+=" -X=main.commit=$(<.git_head)"
'';
# Test failure in vendored yaml package, see:
# https://github.com/google/yamlfmt/issues/256
checkFlags = [ "-run=!S/TestNodeRoundtrip" ];