From b6ddf37d2f84ac123e5d617963f73f1535c9e183 Mon Sep 17 00:00:00 2001 From: Nguyen Tran Hau Date: Fri, 7 Aug 2020 10:16:35 +0700 Subject: [PATCH] Create Modules.md --- Development/Go/Modules.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Development/Go/Modules.md diff --git a/Development/Go/Modules.md b/Development/Go/Modules.md new file mode 100644 index 0000000..3fe219c --- /dev/null +++ b/Development/Go/Modules.md @@ -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 +```