Skip to content

Commit

Permalink
all: go fmt ./... with go1.19 (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
eNV25 committed Aug 5, 2022
1 parent f9aa9cb commit 976602f
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion assert_test.go
Expand Up @@ -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()

Expand Down
14 changes: 7 additions & 7 deletions float32_ext.go
Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions float64_ext.go
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion internal/gen-atomicint/main.go
Expand Up @@ -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.
Expand Down
22 changes: 11 additions & 11 deletions internal/gen-atomicwrapper/main.go
Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions nocmp.go
Expand Up @@ -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()
4 changes: 2 additions & 2 deletions nocmp_test.go
Expand Up @@ -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 }

Expand Down

0 comments on commit 976602f

Please sign in to comment.