If you have multiple packages with the same name, goimports sometimes chooses the wrong package. (https://github.com/golang/go/issues/17557). A fix for that is in the works, but there are going to be other cases where goimports can't make a good choice.
I think it would be better to copy all the imports from the source file, then let goimports remove the ones that are not needed.
If you have multiple packages with the same name, goimports sometimes chooses the wrong package. (https://github.com/golang/go/issues/17557). A fix for that is in the works, but there are going to be other cases where goimports can't make a good choice.
I think it would be better to copy all the imports from the source file, then let goimports remove the ones that are not needed.