I need to create GO project (first time) for production, I searched on web for best practices and found the following
https://github.com/golang-standards/project-layout
For this I've two main questions.
I see that most of go projects logic is inside the main function, but in case I need some utils folder with files there, where should I put it ? I don't want that the main function will be mass of 500 or more lines of code
In our company the projects should be build like following
myproj
|-src
|-cmd
| |-main.go
|-utils
|-vendor
Our company project build as above structure i.e. the project files is under the src
folder, is it right? (can we have issue in the future with this structure type).
I was able to compile this project in our landscape but since everything is under src
I'm not sure.
based on https://github.com/anacrolix/torrent
GOPATH
|-src
|-projectA
|-cmd (of projectA)
|-cmdA
|-main.go
|-cmdB
|-main.go
|-vendor
|-pkg lib
|-pkg libB
|-projectB
...
Following is go project structure I have used for go projects
my-project
|-> api
|-> api_test
|-> controllers
|-> controllers_test
|-> models
|-> routes
|-> server
|-> vendor
|main.go
|Readme.txt
Find more about go project structure