Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync/atomic: CompareAndSwapPointer should be CompareAndSwap #47699

Closed
shoenseiwaso opened this issue Aug 14, 2021 · 4 comments
Closed

sync/atomic: CompareAndSwapPointer should be CompareAndSwap #47699

shoenseiwaso opened this issue Aug 14, 2021 · 4 comments
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@shoenseiwaso
Copy link
Contributor

The comment states CompareAndSwapPointer but it should be name of the function, CompareAndSwap:

go/src/sync/atomic/value.go

Lines 129 to 134 in 2422c5e

// CompareAndSwapPointer executes the compare-and-swap operation for the Value.
//
// All calls to CompareAndSwap for a given Value must use values of the same
// concrete type. CompareAndSwap of an inconsistent type panics, as does
// CompareAndSwap(old, nil).
func (v *Value) CompareAndSwap(old, new interface{}) (swapped bool) {

@seankhliao seankhliao added Documentation NeedsFix The path to resolution is known, but the work has not been done. labels Aug 14, 2021
@seankhliao seankhliao changed the title CompareAndSwapPointer should be CompareAndSwap sync/atomic: CompareAndSwapPointer should be CompareAndSwap Aug 14, 2021
@gopherbot
Copy link

Change https://golang.org/cl/342210 mentions this issue: sync/atomic: fix documentation for CompareAndSwap

@rhysh
Copy link
Contributor

rhysh commented Aug 14, 2021

CC @golang/release , this is a new API for Go 1.17, and the release branch doesn't have the fix yet (see https://github.com/golang/go/blob/release-branch.go1.17/src/sync/atomic/value.go#L129 ). For your consideration, so it doesn't get lost in the shuffle on Monday.

@gopherbot please backport to 1.17

@gopherbot
Copy link

Backport issue(s) opened: #47703 (for 1.17).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@dmitshur dmitshur added this to the Go1.18 milestone Aug 15, 2021
@gopherbot
Copy link

Change https://golang.org/cl/342329 mentions this issue: [release-branch.go1.17] sync/atomic: fix documentation for CompareAndSwap

gopherbot pushed a commit that referenced this issue Aug 15, 2021
…Swap

The documentation for CompareAndSwap atomic/value incorrectly labelled
the function as CompareAndSwapPointer. This PR fixes that.

Updates #47699.
Fixes #47703.

Change-Id: I6db08fdfe166570b775248fd24550f5d28e3434e
GitHub-Last-Rev: 41f7870
GitHub-Pull-Request: #47700
Reviewed-on: https://go-review.googlesource.com/c/go/+/342210
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Go Bot <gobot@golang.org>
(cherry picked from commit 0a0a160)
Reviewed-on: https://go-review.googlesource.com/c/go/+/342329
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Aug 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants