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
// 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()

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.
// 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) {

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.
// 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) {

View File

@@ -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.

View File

@@ -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.

View File

@@ -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()

View File

@@ -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 }