Bit #41
To remove a package in a Go project:
-
Run
go get
and postfix the package path with@none
.Terminal window $ go get github.com/path/to/package@none -
Remove all references to the package in your code, then run
go mod tidy
, which will automatically remove any unused packages from your go.mod and go.sum files.Terminal window $ go mod tidy -v