tags:

views:

141

answers:

1
+3  A: 

It's because Int is a struct with unexported fields. When you pass a struct by value to a function, you're making a copy of it. The Go spec states that for this to be legal

...either all fields of T must be exported, or the assignment must be in the same package in which T is declared. In other words, a struct value can be assigned to a struct variable only if every field of the struct may be legally assigned individually by the program.

Evan Shaw