x/tools/cmd/goimports: add configuration mechanism for ignore list #16386

Closed
bradfitz opened this Issue Jul 15, 2016 · 6 comments

Projects

None yet

3 participants

@bradfitz
Member

Per the golang-nuts thread (https://groups.google.com/forum/#!msg/golang-nuts/in9IVmPc_fQ/BO4wzOylCAAJ), goimports should have a configuration mechanism to permit designated ignored directories.

@bradfitz bradfitz added this to the Unreleased milestone Jul 15, 2016
@bradfitz bradfitz self-assigned this Jul 15, 2016
@ghost
ghost commented Jul 15, 2016

Please make an unified mechanism. Then other src-scanning tools could also use it.

@bradfitz
Member

@pi, which other ones? Who should I talk to? Does one already exist?

@ghost
ghost commented Jul 15, 2016

godoc for example;
in analysys/analysys.go:

    // Enumerate packages in $GOPATH.
    for i, dir := range filepath.SplitList(build.Default.GOPATH) {
        root := filepath.Join(dir, "src") + string(os.PathSeparator)
....

And I doubt you should talk to anyone. You boss ;)

@gopherbot

CL https://golang.org/cl/24971 mentions this issue.

@gopherbot gopherbot pushed a commit to golang/tools that closed this issue Jul 15, 2016
@bradfitz bradfitz imports: add configuration mechanism to exclude directories
Each $GOPATH entry may have a file $GOPATH/src/.goimportsignore which
may contain blank lines, #comment lines, or lines naming a directory
relative to the configuration file to ignore when scanning.  No
globbing or regex patterns are allowed.

Updates golang/go#16367 (goimports speed)
Fixes golang/go#16386 (add mechanism to ignore directories)

Change-Id: I8f1a88ae6c4d0ed3075444d70aec3e2228c5ce6a
Reviewed-on: https://go-review.googlesource.com/24971
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
ffe4e61
@thomasf
thomasf commented Jul 19, 2016 edited

@bradfitz the other src tool that I use quite a bit is gorename.. It maybe takes about a minute to run it and it spews out errors about C code which isn't used by any Go code at all.. I'll guess that the answer of which source tool needs speed improvements differ depending on who uses what often.

Btw, It's probably better to have separate ignore files per tool for flexibility, one can always use symlinks to use a single file if the format is the same.

(and... thanks for the very much speedier goimports)

@bradfitz
Member

@thomasf, I filed #16427 to track that. Let's move any discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment