d2: fix version string and raster closure test

Upstream renamed the Go module from oss.terrastruct.com/d2 to
github.com/d2lang/d2 in 0.9.0, so the -X ldflag no longer matched
anything and `d2 --version` reported the baked-in v0.8.1-HEAD.

The new d2renderers/d2raster closure test shells out to
`go list -mod=readonly -deps`, which overrides GOFLAGS=-mod=vendor and
therefore bypasses vendor/, leaving it to resolve modules from an empty
module cache with GOPROXY=off. Switch to proxyVendor so the cache is
populated.

Assisted-by: Claude Code (Claude Opus 5)
This commit is contained in:
Yi-Jyun Pan
2026-09-14 08:04:45 +00:00
parent ee9370f46e
commit 20fb06d29d

View File

@@ -29,7 +29,11 @@ buildGo127Module (finalAttrs: {
hash = "sha256-HhCktLU43Y/uje038axwO7tNqO353mV/JID223sBtd8=";
};
vendorHash = "sha256-LRvQ4diXmoZNnRomVv6HTni6jrJ8e0IHqxVmJhEFR/w=";
# d2renderers/d2raster's TestRasterPackageHasNoIOCapabilities shells out to
# `go list -mod=readonly -deps`, which bypasses the vendor directory and needs
# a populated module cache.
proxyVendor = true;
vendorHash = "sha256-6rrFjboeJ2Qln5TxbsJKmyTclIh1gz1X91g5IFjbMKo=";
excludedPackages = [
"./ci"
@@ -40,7 +44,7 @@ buildGo127Module (finalAttrs: {
ldflags = [
"-s"
"-w"
"-X oss.terrastruct.com/d2/lib/version.Version=v${finalAttrs.version}"
"-X github.com/d2lang/d2/lib/version.Version=v${finalAttrs.version}"
];
nativeBuildInputs = [