golang: go mod edit directive

This commit is contained in:
Akbar Rahman 2021-08-04 14:38:23 +01:00
parent 94a03df352
commit cb82c51f8c
Signed by: alvierahman90
GPG Key ID: 20609519444A1269

17
go.md
View File

@ -32,4 +32,21 @@ It's easy to understand and teaches you all you need to know.
go get golang.org/x/tools/cmd/godoc go get golang.org/x/tools/cmd/godoc
``` ```
# `go.mod`
## `replace` [^go-mod-edit]
```
go mod edit -replace old.repo/location=../new/location
```
> The `-replace=old[@v]=new[@v]` flag adds a replacement of the given
> module path and version pair. If the @v in old@v is omitted, a
> replacement without a version on the left side is added, which applies
> to all versions of the old module path. If the @v in new@v is omitted,
> the new path should be a local module root directory, not a module
> path. Note that -replace overrides any redundant replacements for old[@v],
> so omitting @v will drop existing replacements for specific versions
[^golang-godoc]: Andrew Gerrand, 31 March 2011 --- <https://blog.golang.org/godoc> [^golang-godoc]: Andrew Gerrand, 31 March 2011 --- <https://blog.golang.org/godoc>
[^go-mod-edit]: <https://golang.org/ref/mod#go-mod-edit>