Best resource for Go project setup


(Charles Lin) #1

Most introductory Go tutorials (or any language, for that matter) start with a very simplified setup scenario. Either you edit a single file and work with that for a while, or you work in the REPL, and work there for a while. You really see the complexity of a language when you see a second file (how does it relate to the first file? Is there a setup script needed? Does it need to be in a certain path?).

Here’s what I understand. You can edit a Go file pretty much anywhere, and then do

go run test.go

And, in principle, you can add more files than just test.go. But is there a resource that explains the standard way to set up a project? Which directory to use? What files need to exist? And also, is there a resource that explains what should go in each file (how to divide up the content). I come from Java where it’s basically one class per file.

Thanks!


(Ivan Matmati) #2

Hi,

You can have a look at these two resources :
https://golang.org/doc/code.html