FAQ
Now, first a case where go vet shouldn't and also doesn't complain:

func test() {
type glVec4 [4]gl.Float
foo := glVec4{0, 0, 0, 1}
println(fmtStr("%v", foo))
}

The imported gl.Float is just aliasing float32.

But with the following, go vet yields "struct literal uses untagged fields":

foo := ugl.GlVec4{0, 0, 0, 1}

Only difference? Now the [4]gl.Float type-alias is imported from another
external package. Yet it's the same [4]gl.Float -- an array type, not a
struct type.

The message goes away when I change it to this:

foo := ugl.GlVec4{0: 0, 1: 0, 2: 0, 3: 1}

But this is hardly a good array literal...

Is that a bug or am I missing something?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • David Symonds at Feb 13, 2013 at 12:59 pm
    go vet doesn't do type checking (yet); it operates purely on the parsed
    AST. It doesn't know what "gl.Float" is, and guesses (wrongly) it is a
    struct.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Philipp Schumann at Feb 13, 2013 at 1:21 pm
    Makes sense -- and I guess that keeps it fast, which is a good thing...

    On Wednesday, February 13, 2013 7:59:15 PM UTC+7, David Symonds wrote:

    go vet doesn't do type checking (yet); it operates purely on the parsed
    AST. It doesn't know what "gl.Float" is, and guesses (wrongly) it is a
    struct.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 13, '13 at 11:22a
activeFeb 13, '13 at 1:21p
posts3
users2
websitegolang.org

2 users in discussion

Philipp Schumann: 2 posts David Symonds: 1 post

People

Translate

site design / logo © 2022 Grokbase