Go Short Variable Declaration Invalid Cases: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 13: | Line 13: | ||
func (a A) m(i int) { | func (a A) m(i int) { | ||
a.i := i + 1 // invalid | a.i := i + 1 // invalid | ||
} | } | ||
... | ... | ||
</pre> | |||
Compiler error: | |||
<pre> | |||
./main.go:12: non-name a.i on left side of := | |||
</pre> | </pre> |
Revision as of 10:58, 4 April 2016
Internal
With Method Receivers' Fields
... type A struct { i int } func (a A) m(i int) { a.i := i + 1 // invalid } ...
Compiler error:
./main.go:12: non-name a.i on left side of :=