From 092d16025c7ab2a355a78143c4c1c68c4a624b79 Mon Sep 17 00:00:00 2001 From: eNV25 Date: Fri, 5 Aug 2022 09:48:16 +0400 Subject: [PATCH] all: go fmt ./... with go1.19 --- assert_test.go | 2 +- float32_ext.go | 14 +++++++------- float64_ext.go | 14 +++++++------- internal/gen-atomicint/main.go | 2 +- internal/gen-atomicwrapper/main.go | 22 +++++++++++----------- nocmp.go | 12 ++++++------ nocmp_test.go | 4 ++-- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/assert_test.go b/assert_test.go index b3465b8..47cfbf2 100644 --- a/assert_test.go +++ b/assert_test.go @@ -31,7 +31,7 @@ import ( // Marks the test as failed if the error cannot be cast into the provided type // with errors.As. // -// assertErrorAsType(t, err, new(ErrFoo)) +// assertErrorAsType(t, err, new(ErrFoo)) func assertErrorAsType(t *testing.T, err error, typ interface{}, msgAndArgs ...interface{}) bool { t.Helper() diff --git a/float32_ext.go b/float32_ext.go index ed47945..39034d2 100644 --- a/float32_ext.go +++ b/float32_ext.go @@ -49,13 +49,13 @@ func (f *Float32) Sub(delta float32) float32 { // but CAS allows a stored NaN to compare equal to a passed in NaN. // This avoids typical CAS loops from blocking forever, e.g., // -// for { -// old := atom.Load() -// new = f(old) -// if atom.CAS(old, new) { -// break -// } -// } +// for { +// old := atom.Load() +// new = f(old) +// if atom.CAS(old, new) { +// break +// } +// } // // If CAS did not match NaN to match, then the above would loop forever. func (f *Float32) CAS(old, new float32) (swapped bool) { diff --git a/float64_ext.go b/float64_ext.go index df36b01..0bcaaed 100644 --- a/float64_ext.go +++ b/float64_ext.go @@ -49,13 +49,13 @@ func (f *Float64) Sub(delta float64) float64 { // but CAS allows a stored NaN to compare equal to a passed in NaN. // This avoids typical CAS loops from blocking forever, e.g., // -// for { -// old := atom.Load() -// new = f(old) -// if atom.CAS(old, new) { -// break -// } -// } +// for { +// old := atom.Load() +// new = f(old) +// if atom.CAS(old, new) { +// break +// } +// } // // If CAS did not match NaN to match, then the above would loop forever. func (f *Float64) CAS(old, new float64) (swapped bool) { diff --git a/internal/gen-atomicint/main.go b/internal/gen-atomicint/main.go index 6e494e4..b00a208 100644 --- a/internal/gen-atomicint/main.go +++ b/internal/gen-atomicint/main.go @@ -20,7 +20,7 @@ // gen-atomicint generates an atomic wrapper around an integer type. // -// gen-atomicint -name Int32 -wrapped int32 -file out.go +// gen-atomicint -name Int32 -wrapped int32 -file out.go // // The generated wrapper will use the functions in the sync/atomic package // named after the generated type. diff --git a/internal/gen-atomicwrapper/main.go b/internal/gen-atomicwrapper/main.go index 3d4f0ac..1dd056d 100644 --- a/internal/gen-atomicwrapper/main.go +++ b/internal/gen-atomicwrapper/main.go @@ -25,25 +25,25 @@ // // Given, atomic.Value and the functions, // -// func packString(string) interface{} -// func unpackString(interface{}) string +// func packString(string) interface{} +// func unpackString(interface{}) string // // We can run the following command: // -// gen-atomicwrapper -name String -wrapped Value \ -// -type string -pack fromString -unpack tostring +// gen-atomicwrapper -name String -wrapped Value \ +// -type string -pack fromString -unpack tostring // // This wil generate approximately, // -// type String struct{ v Value } +// type String struct{ v Value } // -// func (s *String) Load() string { -// return unpackString(v.Load()) -// } +// func (s *String) Load() string { +// return unpackString(v.Load()) +// } // -// func (s *String) Store(s string) { -// return s.v.Store(packString(s)) -// } +// func (s *String) Store(s string) { +// return s.v.Store(packString(s)) +// } // // The packing/unpacking logic allows the stored value to be different from // the user-facing value. diff --git a/nocmp.go b/nocmp.go index a8201cb..54b7417 100644 --- a/nocmp.go +++ b/nocmp.go @@ -23,13 +23,13 @@ package atomic // nocmp is an uncomparable struct. Embed this inside another struct to make // it uncomparable. // -// type Foo struct { -// nocmp -// // ... -// } +// type Foo struct { +// nocmp +// // ... +// } // // This DOES NOT: // -// - Disallow shallow copies of structs -// - Disallow comparison of pointers to uncomparable structs +// - Disallow shallow copies of structs +// - Disallow comparison of pointers to uncomparable structs type nocmp [0]func() diff --git a/nocmp_test.go b/nocmp_test.go index 055f6f0..7558ae0 100644 --- a/nocmp_test.go +++ b/nocmp_test.go @@ -96,8 +96,8 @@ func TestNocmpSize(t *testing.T) { // // We need to allow this so that users can do, // -// var x atomic.Int32 -// x = atomic.NewInt32(1) +// var x atomic.Int32 +// x = atomic.NewInt32(1) func TestNocmpCopy(t *testing.T) { type foo struct{ _ nocmp }