In section 4.4 (Structs) of The Go Programming Language, there is a code excerpt:
var dilbert Employee
func EmployeeByID(id int) *Employee { /* ... */ }
id := dilbert.ID
EmployeeByID(id).salary = 0
with the remark
If the result type of
EmployeeByID
were changed toEmployee
instead of*Employee
, the assignment statement would not compile since its left-hand side would not identify a variable.
I don't understand why changing the result type of EmployeeByID
to Employee
would cause LHS not identify a variable.