go modules

main
hau 2020-10-14 14:32:31 +07:00
parent 4b022ed41e
commit 8cf8ec078a
1 changed files with 16 additions and 4 deletions

View File

@ -12,8 +12,8 @@ Daily workflow:
# Update modules
go get -u ./...
# Install module with chosen commit or branch
go get public.git.com/module@branch
# Install module with chosen commit or version
go get public.git.com/module@version
# Prune no longer used modules
go mod tidy
@ -28,10 +28,22 @@ Outside modules:
GOMODULE11=on go get example.com/foo/bar
```
Update go version in `go.mod`:
Update go version:
```sh
go mod edit -go-1.xy
go mod edit -go=1.XY
```
Replace module path and version pair:
```sh
go mod edit -replace old[@v]=new[@v]
```
Drop replace module path:
```sh
go mod edit -dropreplace old[@v]
```
In world of corporation, we work with private repository, add to `~/.bashrc`, `~/.zshrc`: