We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
go version
$ go version go version go1.12.7 linux/amd64
the sample code:
package main import ( "log" "os" ) func main() { file, error := os.Open("hs.json") if error != nil { log.Println("open file ", error) return } defer file.Close() h := func(string) error { return nil } h("hello") }
i am beginner with golang, the go vet output is 'error is not a type'. so, it can be confusing to fix problem
The text was updated successfully, but these errors were encountered:
Go has a flat namespace: variable names and and type-names can (and do) shadow each other.
Here, you have declared a local variable error (on line 9), and it shadows the declaration of the built-in type error.
error
Sorry, something went wrong.
Duplicate of #33567
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
What version of Go are you using (
go version
)?What did you do?
the sample code:
What did you see instead?
i am beginner with golang, the go vet output is 'error is not a type'. so, it can be confusing to fix problem
The text was updated successfully, but these errors were encountered: