chore: better go modules
parent
7aae465cf0
commit
defc8ea7c8
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue