The program prints false. Two ingredient’s locations are not the same even if they were initialised from the same constant because the Location() method returns the address of the receivers location field. As each ingredient occupies a unique location in memory, the address of i.location will be unique, even though the contents are not.
The moral of the story, returning the address of a value type, a string, or even a slice, and certainly a map, is unusual, and generally requires exceptional circumstances. Let your nose guide you when you smell this one in the field.
Pages: 1 2