diff --git a/bool.go b/bool.go index 1bf3fa0..9cf1914 100644 --- a/bool.go +++ b/bool.go @@ -28,7 +28,7 @@ import ( // Bool is an atomic type-safe wrapper for bool values. type Bool struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v Uint32 } diff --git a/duration.go b/duration.go index 30ed6aa..027cfcb 100644 --- a/duration.go +++ b/duration.go @@ -29,7 +29,7 @@ import ( // Duration is an atomic type-safe wrapper for time.Duration values. type Duration struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v Int64 } diff --git a/error.go b/error.go index cedbc91..a6166fb 100644 --- a/error.go +++ b/error.go @@ -24,7 +24,7 @@ package atomic // Error is an atomic type-safe wrapper for error values. type Error struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v Value } diff --git a/float64.go b/float64.go index fb33e90..0719060 100644 --- a/float64.go +++ b/float64.go @@ -29,7 +29,7 @@ import ( // Float64 is an atomic type-safe wrapper for float64 values. type Float64 struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v Uint64 } diff --git a/int32.go b/int32.go index 357f178..18ae564 100644 --- a/int32.go +++ b/int32.go @@ -30,7 +30,7 @@ import ( // Int32 is an atomic wrapper around int32. type Int32 struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v int32 } diff --git a/int64.go b/int64.go index 8448018..2bcbbfa 100644 --- a/int64.go +++ b/int64.go @@ -30,7 +30,7 @@ import ( // Int64 is an atomic wrapper around int64. type Int64 struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v int64 } diff --git a/internal/gen-atomicint/main.go b/internal/gen-atomicint/main.go index 4ffcb94..211cd34 100644 --- a/internal/gen-atomicint/main.go +++ b/internal/gen-atomicint/main.go @@ -135,7 +135,7 @@ import ( // {{ .Name }} is an atomic wrapper around {{ .Wrapped }}. type {{ .Name }} struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v {{ .Wrapped }} } diff --git a/internal/gen-atomicwrapper/main.go b/internal/gen-atomicwrapper/main.go index 0bb180e..862c411 100644 --- a/internal/gen-atomicwrapper/main.go +++ b/internal/gen-atomicwrapper/main.go @@ -227,7 +227,7 @@ import ( // {{ .Name }} is an atomic type-safe wrapper for {{ .Type }} values. type {{ .Name }} struct{ - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v {{ .Wrapped }} } diff --git a/nocmp_test.go b/nocmp_test.go index 267119e..d4be166 100644 --- a/nocmp_test.go +++ b/nocmp_test.go @@ -77,14 +77,13 @@ func TestNocmpComparability(t *testing.T) { // nocmp must not add to the size of a struct in-memory. func TestNocmpSize(t *testing.T) { - type x struct{ i int } + type x struct{ _ int } before := reflect.TypeOf(x{}).Size() type y struct { - nocmp - - x x + _ nocmp + _ x } after := reflect.TypeOf(y{}).Size() @@ -100,7 +99,7 @@ func TestNocmpSize(t *testing.T) { // var x atomic.Int32 // x = atomic.NewInt32(1) func TestNocmpCopy(t *testing.T) { - type foo struct{ nocmp } + type foo struct{ _ nocmp } t.Run("struct copy", func(t *testing.T) { a := foo{} diff --git a/string.go b/string.go index 8e3ac35..225b7a2 100644 --- a/string.go +++ b/string.go @@ -24,7 +24,7 @@ package atomic // String is an atomic type-safe wrapper for string values. type String struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v Value } diff --git a/uint32.go b/uint32.go index 3fbb696..a973aba 100644 --- a/uint32.go +++ b/uint32.go @@ -30,7 +30,7 @@ import ( // Uint32 is an atomic wrapper around uint32. type Uint32 struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v uint32 } diff --git a/uint64.go b/uint64.go index 7cec96b..3b6c71f 100644 --- a/uint64.go +++ b/uint64.go @@ -30,7 +30,7 @@ import ( // Uint64 is an atomic wrapper around uint64. type Uint64 struct { - nocmp // disallow non-atomic comparison + _ nocmp // disallow non-atomic comparison v uint64 } diff --git a/value.go b/value.go index 5c32903..671f3a3 100644 --- a/value.go +++ b/value.go @@ -25,6 +25,7 @@ import "sync/atomic" // Value shadows the type of the same name from sync/atomic // https://godoc.org/sync/atomic#Value type Value struct { - nocmp // disallow non-atomic comparison atomic.Value + + _ nocmp // disallow non-atomic comparison }