This repository has been archived by the owner on May 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 492
Type inferrence flagged incorrectly #7
Labels
Comments
Yes, there's a large class of things that golint gets wrong for that (the more common is when the LHS is an interface). Still, it's relatively unusual to write code like that, and you can work around it easily enough (write "var x = b(foo())"). It'll need the full typechecking wired up to do it completely correctly, and that won't happen for a while. |
Same root cause for this symptom? package main
import (
"math"
)
func main() {
var i uint64 = math.MaxUint64
println(i)
} $ golint a.go
a.go:8:8: should omit type uint64 from declaration of var i; it will be inferred from the right-hand side — package main
import (
"math"
)
func main() {
i := math.MaxUint64
println(i)
}
|
Yes, that's the same cause. |
bumping up. Other example
and I want to use
|
Another example for the record: Link to p.go: http://play.golang.org/p/9DvFBwDYlc
Link to update version of p.go: http://play.golang.org/p/sGuwidVxjN
|
dsymonds
added a commit
that referenced
this issue
Sep 1, 2014
This does nothing with the extra information except warn if there's an error returned by the typechecker (e.g. var not used). This is the first step towards addressing #7.
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: