Skip to content

Fix go 1.17 build: use atomic.LoadInt32/StoreInt32 instead of atomic.Int32#6

Merged
mjradwin merged 1 commit into
mainfrom
claude/atomic-go117-fix
May 25, 2026
Merged

Fix go 1.17 build: use atomic.LoadInt32/StoreInt32 instead of atomic.Int32#6
mjradwin merged 1 commit into
mainfrom
claude/atomic-go117-fix

Conversation

@mjradwin

Copy link
Copy Markdown
Member

Summary

PR #5 merged with the Go 1.19+ form of atomic (atomic.Int32 with .Load()/.Store() methods), but go.mod declares go 1.17 and CI builds against Go 1.17. The current main build is failing with:

./hdate.go:187:42: undefined: atomic.Int32

This switches to the function-form atomics (atomic.LoadInt32 / atomic.StoreInt32) on a plain [N]int32 array. These have existed since Go 1.0 and generate the same MOV instructions on x86/arm as the typed wrapper, so the cache stays race-free with no change to runtime behavior or performance.

Test plan

  • go build -v ./... succeeds
  • go test ./... passes
  • go test -race ./... clean
  • go vet ./... clean
  • staticcheck -checks=all ./... clean

Generated by Claude Code

atomic.Int32 (the typed wrapper with .Load()/.Store() methods) is a
Go 1.19 addition, but go.mod declares go 1.17 and CI builds against
1.17 — the previous change broke the build with:

  ./hdate.go:187:42: undefined: atomic.Int32

Switch to the function-form atomics on a plain [N]int32 array; they
generate the same instructions on x86/arm and have existed since Go
1.0, so the cache stays race-free with no runtime overhead change.
@mjradwin
mjradwin merged commit 0a87855 into main May 25, 2026
2 checks passed
@mjradwin
mjradwin deleted the claude/atomic-go117-fix branch May 25, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants