Issue 1:
the 386 builders are all dying in the go.net subrepo with messages like

? code.google.com/p/go.net/dict [no test files]
ok code.google.com/p/go.net/html 0.140s
ok code.google.com/p/go.net/html/atom 0.006s
# code.google.com/p/go.net/ipv4
registers allocated at
AX 0
CX 0
DX 0
BX 0xd2f8
SP 0
BP 0xd2f8
SI 0xd2f8
DI 0xc1b7
registers allocated at
AX 0
CX 0
DX 0
BX 0xd2f8
SP 0
BP 0xd2f8
SI 0xd2f8
DI 0xc1b7
/tmp/gobuilder/darwin-386-03e5b26282f7/src/code.google.com/p/go.net/ipv4/control.go:1:
out of fixed registers
/tmp/gobuilder/darwin-386-03e5b26282f7/src/code.google.com/p/go.net/ipv4/control.go:1:
internal compiler error: regfree: reg not allocated
ok code.google.com/p/go.net/html/charset 0.011s
ok code.google.com/p/go.net/idna 0.013s
FAIL code.google.com/p/go.net/ipv4 [build failed]
# code.google.com/p/go.net/ipv6
registers allocated at
AX 0
CX 0
DX 0
BX 0xd2f8
SP 0
BP 0xd2f8
SI 0xd2f8
DI 0xc1b7
registers allocated at
AX 0
CX 0
DX 0
BX 0xd2f8
SP 0
BP 0xd2f8
SI 0xd2f8
DI 0xc1b7
/tmp/gobuilder/darwin-386-03e5b26282f7/src/code.google.com/p/go.net/ipv6/control.go:1:
out of fixed registers
/tmp/gobuilder/darwin-386-03e5b26282f7/src/code.google.com/p/go.net/ipv6/control.go:1:
internal compiler error: regfree: reg not allocated
FAIL code.google.com/p/go.net/ipv6 [build failed]
ok code.google.com/p/go.net/netutil 0.642s
ok code.google.com/p/go.net/proxy 0.010s
ok code.google.com/p/go.net/publicsuffix 0.178s
ok code.google.com/p/go.net/spdy 0.017s
ok code.google.com/p/go.net/websocket 0.030s

Issue 2:
Currently if there are duplicate anonymous struct fields they are all ignored. I think this is wrong because the encoding process shouldn't loose information unless the output format is not capable to represent it(which is not the case).

For example marshalling AllTypes produces an empty output.

type AllTypes struct {

Type1

Type2

}

type Type1 struct {

Name string

Address string

}

type Type2 struct {

Name string

Address string

}

To overcome this issue an additional step is required to create a boilerplate type specially for the encoding/decoding process. Most likely we end-up with a new type (AllTypes2) as below. This is against the composability of the language and adds additional burden to the developer(look for duplicate fields -> create a new type).

type AllTypes2 struct{

Type1 Type1

Type2 Type2

}

Any fix/convention that preserves the data would be fine to me but I present my proposal below too as starting point. I think it's also backward compatible.

Use the same addressing like the native go types.

If there are duplicate anonymous fields, they should be addressed using the type name as prefix. If the type name is duplicate too both the package name and the type name should be used as prefix. For type AllTypes I would expect the output below:

{

"Type1": {"Name":"example", "Address": "example"},

"Type2": {"Name":"example", "Address": "example"}

}

Using the same addressing as on go types makes the behaviour intuitive and easier to understand too as we have only one familiar rule instead of 3 special rules.

It would make the behaviour more consistent too because the type name is already used as key on certain cases. For example type SomeType is encoded to {"MySlice":["somedata"]}.

type SomeType struct{

MySlice

}

type MySlice []string