-
Notifications
You must be signed in to change notification settings - Fork 18k
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: improve go compiler's syntax error message style #39274
Comments
While I understand the sentiment and agree that better error messages are a good thing for users, this issue doesn’t have a concrete proposal of what, precisely, should be improved. Without more actionable examples and proposed changes, this is difficult to act upon. What, precisely, would you like to see changed? |
make it more like gcc. Also rustc looks good. |
@delata No, we don't know what you mean. We can guess, but experience tells me that our guess will not be what you expect. You know what you want. There is no reason to make us guess. |
try, helloworld with syntax error. |
i am unable to communicate my thought properly. sorry. English isn't my native language. currently i don't have access to a computer. i am writing this from a phone. What you think about current error message style. are they good? if not, then discuss with core team and improve. please. this is the only reason i can't learn Go. I make a lot of syntax error and when i try to compile Go compiler don't give any good suggestion. |
Show us exactly what you did. Show us exactly what happened. Show us what you want to happen instead. Otherwise we cannot help you. Sorry. |
Given two “hello, world” examples with syntax errors (in C and Go, respectively): C program:
gcc error:
Go program:
gc error:
The warning is arguably more helpful, but both errors seem very similar. Note that Go doesn’t have warnings. If we interpret the warning as an error, then how granular is this specific request? Show a ^ under the offending line? Color-code the output? Show an error when there is no terminating quote in a string? That’s just for one class of errors. We are sensitive to the sentiment you’re attempting to communicate, but the details matter. We can’t read your mind and are empathetic to the challenges that being a non-native English speaker presents, but without concrete requirements it’s very difficult for us to move forward. Additionally, asking us to run different compilers and compare output ourselves instead of running the commands yourself can be interpreted as you wanting others to do an outsized amount of work to, again, end up with a potential solution that doesn’t fit your requirements. Closing for now. If you have more concrete requirements you’d like to communicate, feel free to do so. Thanks. |
Compare to Typescropt: class Foo {
doSomething() {
}
}
new Foo().doSomethin() Yields:
Compare to Go: type Foo struct {
}
func(f Foo) doSomething() {
}
func main() {
f := Foo{}
f.doSomethin()
} yields:
There are a couple of things that I think make the TS version of this ergonomically better:
|
If i take a look at GCC 's error massage, i see that they are very user friendly and descriptive.
Also provide suggestions how to fix the error.
I wish Go compiler will have this features.
try helloworld on Go and GCC with syntax error. to understand what i am saying
thanks.
The text was updated successfully, but these errors were encountered: