undefined: NewRouter
Closed this issue · 3 comments
kalelc commented
Hello, in first thanks for your tutorial :)
I have a problem when try execute go run main.go
I get message # command-line-arguments ./main.go:10: undefined: NewRouter
.
pollonamid commented
Hi. go run
doesn't work well with multi file projects. Use go build
and then run the generated executable.
kalelc commented
Thanks!! go run *
or go build
works fine.
leogaletti commented
Is it okay to work this way with go with multiple files in the project? This is a question I've been asking myself since I started learning go. I thought it would be necessary to always create packages for each thing, for example the router file, I thought I would have to create an internal package to be using go the correct way. Thank you for your help!