Answer the question
In order to leave comments, you need to log in
Why does Go throw Undefined for a struct declared in the same package?
Good afternoon, comrades! I'm doing a small project on Go, until recently it was going well, but for some reason in the following case it began to give an error:
The main.go file contains the following code:
package main
func main() {
var m = Message{
Type: "LOL",
}
println(m.Type)
}
package main
// Message - test message
type Message struct {
Type string
}
go run main.go
.\main.go:4:10: undefined: Message
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question