all: go fmt ./... with go1.19 (#110)

This commit is contained in:
eNV25
2022-08-05 20:14:45 +04:00
committed by GitHub
parent f9aa9cb571
commit 976602f5dc
7 changed files with 35 additions and 35 deletions

View File

@@ -31,7 +31,7 @@ import (
// Marks the test as failed if the error cannot be cast into the provided type // Marks the test as failed if the error cannot be cast into the provided type
// with errors.As. // 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 { func assertErrorAsType(t *testing.T, err error, typ interface{}, msgAndArgs ...interface{}) bool {
t.Helper() t.Helper()

View File

@@ -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. // but CAS allows a stored NaN to compare equal to a passed in NaN.
// This avoids typical CAS loops from blocking forever, e.g., // This avoids typical CAS loops from blocking forever, e.g.,
// //
// for { // for {
// old := atom.Load() // old := atom.Load()
// new = f(old) // new = f(old)
// if atom.CAS(old, new) { // if atom.CAS(old, new) {
// break // break
// } // }
// } // }
// //
// If CAS did not match NaN to match, then the above would loop forever. // If CAS did not match NaN to match, then the above would loop forever.
func (f *Float32) CAS(old, new float32) (swapped bool) { func (f *Float32) CAS(old, new float32) (swapped bool) {

View File

@@ -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. // but CAS allows a stored NaN to compare equal to a passed in NaN.
// This avoids typical CAS loops from blocking forever, e.g., // This avoids typical CAS loops from blocking forever, e.g.,
// //
// for { // for {
// old := atom.Load() // old := atom.Load()
// new = f(old) // new = f(old)
// if atom.CAS(old, new) { // if atom.CAS(old, new) {
// break // break
// } // }
// } // }
// //
// If CAS did not match NaN to match, then the above would loop forever. // If CAS did not match NaN to match, then the above would loop forever.
func (f *Float64) CAS(old, new float64) (swapped bool) { func (f *Float64) CAS(old, new float64) (swapped bool) {

View File

@@ -20,7 +20,7 @@
// gen-atomicint generates an atomic wrapper around an integer type. // 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 // The generated wrapper will use the functions in the sync/atomic package
// named after the generated type. // named after the generated type.

View File

@@ -25,25 +25,25 @@
// //
// Given, atomic.Value and the functions, // Given, atomic.Value and the functions,
// //
// func packString(string) interface{} // func packString(string) interface{}
// func unpackString(interface{}) string // func unpackString(interface{}) string
// //
// We can run the following command: // We can run the following command:
// //
// gen-atomicwrapper -name String -wrapped Value \ // gen-atomicwrapper -name String -wrapped Value \
// -type string -pack fromString -unpack tostring // -type string -pack fromString -unpack tostring
// //
// This wil generate approximately, // This wil generate approximately,
// //
// type String struct{ v Value } // type String struct{ v Value }
// //
// func (s *String) Load() string { // func (s *String) Load() string {
// return unpackString(v.Load()) // return unpackString(v.Load())
// } // }
// //
// func (s *String) Store(s string) { // func (s *String) Store(s string) {
// return s.v.Store(packString(s)) // return s.v.Store(packString(s))
// } // }
// //
// The packing/unpacking logic allows the stored value to be different from // The packing/unpacking logic allows the stored value to be different from
// the user-facing value. // the user-facing value.

View File

@@ -23,13 +23,13 @@ package atomic
// nocmp is an uncomparable struct. Embed this inside another struct to make // nocmp is an uncomparable struct. Embed this inside another struct to make
// it uncomparable. // it uncomparable.
// //
// type Foo struct { // type Foo struct {
// nocmp // nocmp
// // ... // // ...
// } // }
// //
// This DOES NOT: // This DOES NOT:
// //
// - Disallow shallow copies of structs // - Disallow shallow copies of structs
// - Disallow comparison of pointers to uncomparable structs // - Disallow comparison of pointers to uncomparable structs
type nocmp [0]func() type nocmp [0]func()

View File

@@ -96,8 +96,8 @@ func TestNocmpSize(t *testing.T) {
// //
// We need to allow this so that users can do, // We need to allow this so that users can do,
// //
// var x atomic.Int32 // var x atomic.Int32
// x = atomic.NewInt32(1) // x = atomic.NewInt32(1)
func TestNocmpCopy(t *testing.T) { func TestNocmpCopy(t *testing.T) {
type foo struct{ _ nocmp } type foo struct{ _ nocmp }