Skip to content

Commit cfee0cb

Browse files
authored
fix: resolve verify checksum matching and changelog generation issues (#12)
- Handle GoReleaser arch variant suffixes (e.g. verda_darwin_arm64_v8.0/) in checksum matching, which caused "no checksum entry found" errors - Remove changelog.disable: true from .goreleaser.yml which silently suppressed --release-notes flag, causing empty release notes
1 parent 2b0f0c0 commit cfee0cb

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

.goreleaser.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ archives:
3232
checksum:
3333
name_template: verda_{{ .Version }}_SHA256SUMS
3434

35-
changelog:
36-
disable: true
35+
# Release notes are provided by git-cliff via --release-notes flag.
36+
# Do NOT set changelog.disable: true — it also ignores --release-notes.

internal/verda-cli/cmd/version/verify.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,23 @@ func parseChecksumLine(line string) (hexStr, key string, ok bool) {
9191
// findMatchingChecksum finds the expected hash for the given OS/arch from the
9292
// checksum file body.
9393
func findMatchingChecksum(body, goos, goarch string) (string, error) {
94-
// The key format is: verda_<os>_<arch>/verda[.exe]
95-
prefix := fmt.Sprintf("verda_%s_%s/", goos, goarch)
94+
// GoReleaser dist directories include arch variant suffixes, e.g.:
95+
// verda_darwin_arm64_v8.0/verda
96+
// verda_linux_amd64_v1/verda
97+
// Match "verda_<os>_<arch>" followed by "/" or "_" (variant suffix).
98+
prefix := fmt.Sprintf("verda_%s_%s", goos, goarch)
9699

97100
for _, line := range strings.Split(body, "\n") {
98101
hexStr, key, ok := parseChecksumLine(line)
99102
if !ok {
100103
continue
101104
}
102-
if strings.HasPrefix(key, prefix) {
105+
if !strings.HasPrefix(key, prefix) {
106+
continue
107+
}
108+
// After the os_arch prefix, expect "/" or "_" (variant like _v8.0/)
109+
rest := key[len(prefix):]
110+
if rest != "" && (rest[0] == '/' || rest[0] == '_') {
103111
return hexStr, nil
104112
}
105113
}

internal/verda-cli/cmd/version/verify_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ func TestParseChecksumLine(t *testing.T) {
8484
func TestFindMatchingChecksum(t *testing.T) {
8585
t.Parallel()
8686

87-
body := `aaa111 verda_linux_amd64/verda
88-
bbb222 verda_darwin_arm64/verda
89-
ccc333 verda_windows_amd64/verda.exe
87+
// GoReleaser dist directories include arch variant suffixes
88+
body := `aaa111 verda_linux_amd64_v1/verda
89+
bbb222 verda_darwin_arm64_v8.0/verda
90+
ccc333 verda_windows_amd64_v1/verda.exe
9091
`
9192

9293
tests := []struct {
@@ -256,7 +257,7 @@ func TestVerifyBinaryMatch(t *testing.T) {
256257

257258
goos := runtime.GOOS
258259
goarch := runtime.GOARCH
259-
checksumBody := fmt.Sprintf("%s verda_%s_%s/verda\n", expectedHash, goos, goarch)
260+
checksumBody := fmt.Sprintf("%s verda_%s_%s_v1/verda\n", expectedHash, goos, goarch)
260261

261262
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
262263
_, _ = fmt.Fprint(w, checksumBody)

0 commit comments

Comments
 (0)