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: deduplicated errors on same line still trigger "too many errors" #14136

Closed
dominikh opened this issue Jan 28, 2016 · 3 comments
Closed
Milestone

Comments

@dominikh
Copy link
Member

For a given line, Go prints the same error only once. For example, trying to use the same unknown field in a struct initialiser multiple times will only emit one error, if that struct initialiser is written on a single line. However, each suppressed error still increments the error counter in Yyerror, which can lead to a "too many errors" even if just one error was actually printed. This can be mildly confusing, and reduces the usefulness of deduplication.

Input
http://play.golang.org/p/S18DnIr63o

package main

type T struct{}

func main() {
    t := T{X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1}
    var s string = 1
}

Output

prog.go:6: unknown T field 'X' in struct literal
prog.go:6: too many errors

Expected output

prog.go:6: unknown T field 'X' in struct literal
prog.go:7: cannot use 1 (type int) as type string in assignment
@griesemer griesemer self-assigned this Jan 28, 2016
@griesemer griesemer added this to the Go1.7 milestone Jan 28, 2016
@rsc
Copy link
Contributor

rsc commented May 17, 2016

This seems trivial to fix, low risk (only affects compiles that will fail anyway), and probably worth fixing for Go 1.7.

@griesemer
Copy link
Contributor

On it.

@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators May 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants