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

method ReadRune() (rune, error) should have signature ReadRune() (rune, int, error) #53

Open
nicks opened this issue Sep 2, 2024 · 0 comments

Comments

@nicks
Copy link

nicks commented Sep 2, 2024

Repro steps

If I try to run go vet on this library, I get:

go vet ./...
go: downloading github.com/mattn/go-runewidth v0.0.16
# github.com/mattn/go-tty
./tty.go:35:17: method ReadRune() (rune, error) should have signature ReadRune() (rune, int, error)

Root cause

ReadRune is now defined as a "standard method" in the go stdlib.

https://cs.opensource.google/go/x/tools/+/refs/tags/v0.24.0:go/analysis/passes/stdmethods/stdmethods.go;l=57

so the Go tooling complains if it has a non-standard signature.

Additional info

Mostly logging this here in case other people run into this problem. It causes all sorts of weird inscrutable errors downstream, e.g., if you try to use define an interface for TTY

type TerminalInput interface {
	ReadRune() (rune, error)
}

var _ TerminalInput = &tty.TTY{}

There's some discussion upstream about adding ways to suppress the error.

golang/go#52445

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant