If I understand correctly - all the source files of a package live at the same scope.
I have two files - room.go:
package main
func newRoom() *room {
return &room{
forward: make(chan []byte),
join: make(chan *client),
leave: make(chan *client),
clients: make(map[*client]bool),
tracer: trace.Off(),
}
}
main.go:
package main
func main() {
r := newRoom()
When I am compiling the code I get the error:
.\main.go:34: undefined: newRoom
Why ?
Full code is here https://github.com/matryer/goblueprints/tree/master/chapter1/chat