Create Modules.md

main
Nguyen Tran Hau 2020-08-07 10:16:35 +07:00 committed by GitHub
parent 32dc1ce6f7
commit b6ddf37d2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 0 deletions

37
Development/Go/Modules.md Normal file
View File

@ -0,0 +1,37 @@
# [Modules](https://github.com/golang/go/wiki/Modules)
First time:
```
go mod init
```
Daily workflow:
```
# Update modules
go get -u ./...
# Install module with chosen commit or branch
go get public.git.com/module@branch
# Prune no longer used modules
go mod tidy
# Copy modules to local vendor directory
go mod vendor
```
In world of corporation, we work with private repository, add to `~/.bashrc`, `~/.zshrc`:
```sh
export GOPRIVATE=private.git.com
```
Last hope, use `~/.netrc`:
```txt
machine private.git.com
login your_user
password your_password
```