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

GoImport doesn't import commented packages #1717

Closed
DevAlone opened this issue Mar 15, 2018 · 1 comment · Fixed by #2862
Closed

GoImport doesn't import commented packages #1717

DevAlone opened this issue Mar 15, 2018 · 1 comment · Fixed by #2862
Assignees

Comments

@DevAlone
Copy link

DevAlone commented Mar 15, 2018

What did you do? (required. The issue will be closed when not provided.)

import (
    "errors"
    // "fmt"
)

:GoImport fmt

What did you expect to happen?

import (
    "errors"
    "fmt"
)

What happened instead?

"fmt" already being imported

Configuration (MUST fill this out):

  • Vim version (first two lines from :version):

NVIM v0.2.2
Build type: RelWithDebInfo

  • Go version (go version):

go version go1.10 linux/amd64

  • Go environment (go env):

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/go"
GORACE=""
GOROOT="/opt/golang"
GOTMPDIR=""
GOTOOLDIR="/opt/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build027896217=/tmp/go-build -gno-record-gcc-switches"

  • vim-go version:

Last installed by vim-plug

  • vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

https://gist.github.com/DevAlone/4f5ec03f17d42ce3bb730060ac1eb594

@arp242
Copy link
Contributor

arp242 commented Mar 15, 2018

The entire thing is a regexp-based mess of ugly. I rewrote the lot with #1559, just need to finish that up when I have the time!

arp242 added a commit to arp242/goimport that referenced this issue Mar 16, 2018
bhcleek added a commit to bhcleek/vim-go that referenced this issue Apr 27, 2020
Adjust the regular expression that matches existing imports so that
commented out package imports will will not be matched.

Fixes fatih#1717
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants