[GH-ISSUE #157] v1.0.4: go vet ./device fails because TestWaitPool copies atomic.Uint32 #80

Open
opened 2026-10-13 21:03:23 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @autopeasant on GitHub (Jul 23, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-go/issues/157

Affected version

  • github.com/amnezia-vpn/amneziawg-go v1.0.4
  • Go 1.26.4
  • Linux amd64

Minimal reproduction

From an unmodified v1.0.4 checkout:

go vet ./device

Observed behavior

device/pools_test.go:65:69: call of t.Errorf copies lock value: sync/atomic.Uint32 contains sync/atomic.noCopy

TestWaitPool passes the atomic.Uint32 value itself to t.Errorf:

t.Errorf("Actual maximum count (%d) != ideal maximum count (%d)", max, p.max)

Formatting the value copies the atomic wrapper, whose embedded noCopy marker makes that operation invalid under the copylocks analyzer.

Expected behavior

go vet ./device should pass. The diagnostic should format the already-observed scalar instead:

t.Errorf("Actual maximum count (%d) != ideal maximum count (%d)", max.Load(), p.max)
Originally created by @autopeasant on GitHub (Jul 23, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-go/issues/157 ## Affected version - `github.com/amnezia-vpn/amneziawg-go v1.0.4` - Go `1.26.4` - Linux amd64 ## Minimal reproduction From an unmodified v1.0.4 checkout: ```sh go vet ./device ``` ## Observed behavior ```text device/pools_test.go:65:69: call of t.Errorf copies lock value: sync/atomic.Uint32 contains sync/atomic.noCopy ``` `TestWaitPool` passes the `atomic.Uint32` value itself to `t.Errorf`: ```go t.Errorf("Actual maximum count (%d) != ideal maximum count (%d)", max, p.max) ``` Formatting the value copies the atomic wrapper, whose embedded `noCopy` marker makes that operation invalid under the `copylocks` analyzer. ## Expected behavior `go vet ./device` should pass. The diagnostic should format the already-observed scalar instead: ```go t.Errorf("Actual maximum count (%d) != ideal maximum count (%d)", max.Load(), p.max) ```
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-go#80
No description provided.