The code in your example shouldn’t (doesn’t, I would say) generate the error you describe.
The “invalid indirect of … literal” means you tried to pointer-dereference a struct literal: *foo{ ... }. Remove the star, or replace it with an ampersand if you wanted a pointer literal.