corylanou/tns-restful-json-api

undefined: NewRouter

Closed this issue · 3 comments

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.

Hi. go run doesn't work well with multi file projects. Use go build and then run the generated executable.

Thanks!! go run * or go build works fine.

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!