chore: better go modules

main
sudo pacman -Syu 2022-08-24 11:29:14 +07:00
parent 7aae465cf0
commit defc8ea7c8
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 14 additions and 4 deletions

View File

@ -10,16 +10,22 @@ Daily workflow:
```sh ```sh
# Update modules # Update modules
go get -u ./... go get -d -u ./...
# Install module with chosen commit or version # Add module with chosen commit or version
go get public.git.com/module@version go get -d public.git.com/path/to/module@version
# Build and intall binary with latest version
go install public.git.com/path/to/module@latest
# Prune no longer used modules # Prune no longer used modules
go mod tidy go mod tidy
# Copy modules to local vendor directory # Copy modules to local vendor directory (vendor is not recommend anymore)
go mod vendor go mod vendor
# Why use module
go mod why -m public.git.com/path/to/module
``` ```
Update go version: Update go version:
@ -33,3 +39,7 @@ In world of corporation, we work with private repository, add to `~/.bashrc`, `~
```sh ```sh
export GOPRIVATE=private.git.com export GOPRIVATE=private.git.com
``` ```
## Thanks
- https://encore.dev/guide/go.mod