How to remove indirect (or vise versa) module from go.mod?

I did a silly thing in that not realizing that I already had github.com/golang/protobuf v1.5.0 I did a go get to get google.golang.org/protobuf and I don’t know how to remove the new one which is essentially the same thing but redirected.

1 Like

Remove imports from your go files and run

 go mod tidy

This will clear the unused dependencies from go.mod file

Detailed info source: https://blog.golang.org/using-go-modules

I should have mentioned that I did that and it didn’t work. I also did a search through the code for google.golang.org/protobuf and I don’t see it anywhere except in go.mod and go.sum.

I am currently on go 1.15.