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/compile: assignment mismatch grammatical error #31099

Open
nobozo opened this Issue Mar 28, 2019 · 5 comments

Comments

Projects
None yet
5 participants
@nobozo
Copy link

nobozo commented Mar 28, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jonf/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jonf/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build622067500=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/7R1_1wboUZ5

What did you expect to see?

/a.go:16:12: assignment mismatch: 2 variables but 1 value

What did you see instead?

./a.go:16:12: assignment mismatch: 2 variable but 1 values

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Mar 28, 2019

Yes, we do not check the no. of variables/values and update the message accordingly. The fix is pretty simple. @griesemer any objections ?

Related #30087

@agnivade agnivade changed the title Funny Minor Error Messsage Grammar Problem cmd/compile: assignment mismatch grammatical error Mar 28, 2019

@griesemer

This comment has been minimized.

Copy link
Contributor

griesemer commented Mar 28, 2019

Let's leave this alone for now. It's probably not the only place, and in the past we have avoided any extra code just to fix the grammar. Maybe at some point we will, but for that I'd rather have a general solution that works everywhere.

@griesemer griesemer added this to the Unplanned milestone Mar 28, 2019

@beoran

This comment has been minimized.

Copy link

beoran commented Mar 28, 2019

May I reccomend https://github.com/jinzhu/inflection
JinZhu wrote a nice inflection library which is MIT licensed and at the cost of less than 300 lines of code, you can have plurals for English. With this permission, you could add this to the Go standard library, and then the compiler can be made to emit grammatically correct English plurals easily.

@mdempsky

This comment has been minimized.

Copy link
Member

mdempsky commented Mar 28, 2019

@beoran Thanks for the tip. It looks like "variables" and "values" are the only words that potentially need inflection within any Go error messages though, so I think an entire inflection library is probably unnecessary.

@beoran

This comment has been minimized.

Copy link

beoran commented Apr 4, 2019

Fair enough, if there's only that few words. You could always import that library later if more plurals become necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.