How to remove an installed package using go modules

后端 未结 1 1930
慢半拍i
慢半拍i 2021-02-05 06:33

I\'ve installed a package using go modules (go get in Go 1.13) and now I want to remove it. In the documentation there is nothing about this and in go get docu neither.

1条回答
  •  醉梦人生
    2021-02-05 07:11

    Found it https://blog.golang.org/using-go-modules#TOC_7.

    go mod tidy

    So basically, once the package is not being imported in any package you can perform a go mod tidy and it will safely remove the unused depencies.

    And if you are vendoring the dependencies, then run the command below to make the module changes be applied in the vendor folder:

    go mod vendor

    0 讨论(0)
提交回复
热议问题