Skip to content

Commit 49204af

Browse files
apocelipesgopherbot
authored andcommitted
internal/bisect: replace atomicPointerDedup to simplify the code
"atomicPointerDedup" is a redundancy of "atomic.Pointer". Since Go 1.22 now requires the final point release of Go 1.20 or later for bootstrap, Go 1.19's atomic.Pointer can be used without problems. atomicPointerDedup is unnecessary and we can remove it now. Change-Id: I0a65ad0b6649cecb73d58dc39c5fd736390d5fa5 GitHub-Last-Rev: 6c6e942 GitHub-Pull-Request: #65987 Reviewed-on: https://go-review.googlesource.com/c/go/+/567656 Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent c764d56 commit 49204af

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

src/internal/bisect/bisect.go

+1-17
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ import (
180180
"runtime"
181181
"sync"
182182
"sync/atomic"
183-
"unsafe"
184183
)
185184

186185
// New creates and returns a new Matcher implementing the given pattern.
@@ -311,22 +310,7 @@ type Matcher struct {
311310
quiet bool // disables all reporting. reset if verbose is true. use case is -d=fmahash=qn
312311
enable bool // when true, list is for “enable and report” (when false, “disable and report”)
313312
list []cond // conditions; later ones win over earlier ones
314-
dedup atomicPointerDedup
315-
}
316-
317-
// atomicPointerDedup is an atomic.Pointer[dedup],
318-
// but we are avoiding using Go 1.19's atomic.Pointer
319-
// until the bootstrap toolchain can be relied upon to have it.
320-
type atomicPointerDedup struct {
321-
p unsafe.Pointer
322-
}
323-
324-
func (p *atomicPointerDedup) Load() *dedup {
325-
return (*dedup)(atomic.LoadPointer(&p.p))
326-
}
327-
328-
func (p *atomicPointerDedup) CompareAndSwap(old, new *dedup) bool {
329-
return atomic.CompareAndSwapPointer(&p.p, unsafe.Pointer(old), unsafe.Pointer(new))
313+
dedup atomic.Pointer[dedup]
330314
}
331315

332316
// A cond is a single condition in the matcher.

0 commit comments

Comments
 (0)