2017-12-13 08:48



I need to create GO project (first time) for production, I searched on web for best practices and found the following

For this I've two main questions.

  1. 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

  2. In our company the projects should be build like following

        |  |-main.go

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.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • douzangdang2225 douzangdang2225 4年前

    based on

          |-cmd (of projectA)
          |-pkg lib
          |-pkg libB
    点赞 评论 复制链接分享
  • doulingna9420 doulingna9420 4年前

    Following is go project structure I have used for go projects

         |-> api
         |-> api_test
         |-> controllers
         |-> controllers_test
         |-> models
         |-> routes
         |-> server
         |-> vendor

    Find more about go project structure

    点赞 评论 复制链接分享