Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/goimports: #17840

Deathstroke72 opened this issue Nov 7, 2016 · 2 comments

x/tools/cmd/goimports: #17840

Deathstroke72 opened this issue Nov 7, 2016 · 2 comments


Copy link

@Deathstroke72 Deathstroke72 commented Nov 7, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?


What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows

What did you do?

Import using the vendor folder. I used the library. In my code, it only references postgres in the datasource name. If I don't use _ in the imports section, goimports deletes the import line for it. I don't want to have to use the _ preface.

What did you expect to see?

What did you see instead?

Copy link

@bradfitz bradfitz commented Nov 7, 2016

This isn't enough information for us to help you.

Please include all the relevant files, ideally in a minimal form to see the problem.

Copy link

@quentinmit quentinmit commented Nov 8, 2016

This is WAI. goimports only preserves the import lines that are used by the rest of the file; if you want to keep an import despite not using it, you need to import it as _ (this is called a blank import). See

@quentinmit quentinmit closed this Nov 8, 2016
@golang golang locked and limited conversation to collaborators Nov 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.