Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/cmd/goimports: goimports removes valid import path #40148
What version of Go are you using (
This is a small bug but mostly working as intended. I'm assuming you were working outside of GOPATH. The examples directory is not a module, so goimports can't find its dependencies outside of GOPATH, and therefore can't determine that the package's name is
Ideally the dependency would be kept if its name is unknown but goimports is already complicated enough and people generally can compile the code they're working on. Once you run it once the import will be given an explicit name and goimports will understand it's in use.