Skip to content

v1.0.4: go vet ./device fails because TestWaitPool copies atomic.Uint32 #157

Description

@autopeasant

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions