Last active
October 29, 2018 09:01
-
-
Save ORESoftware/894438aee1d16aa9b2cb12ba25df274e to your computer and use it in GitHub Desktop.
cannot return non-expression? Cannot return a type/struct?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models | |
// note we get a compilation error, shown below | |
import ( | |
nearby "huru/models/nearby" | |
person "huru/models/person" | |
share "huru/models/share" | |
) | |
func getModels() struct{} { | |
return struct { | |
Near nearby.Map | |
Pers person.Map | |
Shar share.Map | |
} | |
} | |
// compilation error: | |
// type struct { Near nearby.Map; Pers person.Map; Shar share.Map } is not an expression | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My explanation: https://mycodesmells.com/post/accept-interfaces-return-struct-in-go#comment-4168079695