unkeyed fields ?

875 views
Skip to first unread message

bsr

unread,
Mar 30, 2014, 4:16:58 PM3/30/14
to golan...@googlegroups.com

What does this error indicates?

mail.go:79:11: composite struct literal net/mail.Address with unkeyed fields

and the line is 

net_mail.Address{"Support", "a...@b.com"},

net_mail is imported as 

net_mail "net/mail"

I searched for "unkeyed" in spec and couldn't find any result.

Thanks.

uveli...@gmail.com

unread,
Mar 30, 2014, 4:48:58 PM3/30/14
to golan...@googlegroups.com
net_mail.Address{Name: "Support",Address: "a...@b.com"}, maybe
> --
> 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...@googlegroups.com.
> For more options, visit http://mandrillapp.com/track/click.php?u=30146375&id=2e2b85d10e444b0591614e8f4561fc68&url=https%3A%2F%2Fgroups.google.com%2Fd%2Foptout&url_id=0eff33bcce254e5290251b570e09b3a407331786.

Dan Kortschak

unread,
Mar 30, 2014, 4:52:51 PM3/30/14
to bsr, golan...@googlegroups.com
Can you post a minimal reproducer to the playground?:

--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

bsr

unread,
Mar 30, 2014, 5:03:05 PM3/30/14
to golan...@googlegroups.com, bsr
thanks for the help. I am getting this error in app engine app. @Uvelichitel is right, the error went away by specifying the key. I  think the error is coming from go vet, and GAE made some stuff stricter in latest release (1.9.1).

David Symonds

unread,
Mar 30, 2014, 6:03:39 PM3/30/14
to bsr, golang-nuts
It's not new. App Engine has been rejecting app code using unkeyed
composite struct literals since early 2012. The issue is that App
Engine wants to accept correct Go code at time T, but then still be
able to recompile it at time T+n, even if the language or standard
libraries have evolved in a backward-compatible way between those two
points in time. For that reason, it is in general strongly recommended
to use keyed composite struct literals in Go code that references
types in other packages, and we enforce that recommendation on App
Engine.

jaim...@gmail.com

unread,
Jun 5, 2014, 12:36:09 PM6/5/14
to golan...@googlegroups.com, bsr...@gmail.com
Hey David. Your explanation makes perfect sense. However the DevAppServer seems to happily accept code with unkeyed fields in its recompile. And this only breaks at push time when one attempts to deploy their application.

I think the two should at least be consistent.

-Jaime

David Symonds

unread,
Jun 5, 2014, 9:09:29 PM6/5/14
to jaim...@gmail.com, golang-nuts, Bsr S
On 6 June 2014 02:36, <jaim...@gmail.com> wrote:

> Hey David. Your explanation makes perfect sense. However the DevAppServer
> seems to happily accept code with unkeyed fields in its recompile. And this
> only breaks at push time when one attempts to deploy their application.
>
> I think the two should at least be consistent.

You're right they should be consistent. I think I know why they aren't
(is the code using an unkeyed struct literal in your GOPATH?). Can you
file a bug on the issue track for this?
Reply all
Reply to author
Forward
0 new messages