Approach 1
For any application project structure, an author recommends below application project structure:
Application
├── cmd/
├── internal/
│ └── platform/
└── vendor/
where vendor/
folder has 3rd party libraries within project structure, which are mostly go get
'ble, but pushed to GitHub repo(in above case). Pushing /vendor
folder to GitHub repo looks unnecessary
Approach 2
I generally go get
3rd party into common local workspace folder(~/golib
), which is outside project structure, and driven by GOPATH
setting shown below. So, the code related to 3rd party is not pushed to GitHub:
export GOPATH=/home/user/golib
export PATH=$PATH:$GOPATH/bin
# First segment of GOPATH is used by "go get" command
# All segments of GOPATH are used for source code
export GOPATH=$GOPATH:/home/user/code
In approach 1, What is the advantage of maintaining vendor/
folder for 3rd party, within application project structure and push to GitHub repo? unlike approach 2