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

cmd/vet: remove Peek from methods check #19719

Closed
josharian opened this issue Mar 26, 2017 · 2 comments
Closed

cmd/vet: remove Peek from methods check #19719

josharian opened this issue Mar 26, 2017 · 2 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@josharian
Copy link
Contributor

vet's methods check ensures that methods with a canonical name have the right signature. This includes:

	"Peek":          {[]string{"=int"}, []string{"[]byte", "error"}},                   // image.reader (matching bufio.Reader)

But it's not clear to me why the unexported image.reader interface is important enough to set the canonical interpretation of Peek.

I see three Peeks in the standard library:

// bufio
func (b *Reader) Peek(n int) ([]byte, error)

// cmd/internal/obj
func (a *AsmBuf) Peek(i int) byte

// text/scanner
func (s *Scanner) Peek() rune

Of these, only bufio.Reader matches. Another Peek that comes to mind is from Russ's article Off to the Races:

// Peek reads and returns the word at address addr.
func (m *Mem) Peek(addr uintptr) uintptr

I think we should remove Peek from the list of canonical method names.

The CL is trivial; this issue is to ask for approval.

@robpike

@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 26, 2017
@bradfitz bradfitz added this to the Go1.9Maybe milestone Mar 26, 2017
@robpike
Copy link
Contributor

robpike commented Mar 27, 2017

Fine with me.

@gopherbot
Copy link

CL https://golang.org/cl/38722 mentions this issue.

lparth pushed a commit to lparth/go that referenced this issue Apr 13, 2017
It is insufficiently canonical;
see the discussion at issue 19719.

Fixes golang#19719

Change-Id: I0559ff3b1b39d7bc4b446d104f36fdf8ce3da50e
Reviewed-on: https://go-review.googlesource.com/38722
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
@golang golang locked and limited conversation to collaborators Mar 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants