Skip to content

x/tools/cmd/goimports: performance issue w/ decently sized $GOPATH/src and undefined identifiers #17612

@sporkmonger

Description

@sporkmonger

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

go version go1.7.3 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/sporkmonger/Projects/Go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.3/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pj/bcdnqjjs2gqdf7yjcgwmlk0c0000gn/T/go-build162676308=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

time goimports -v < myfile.go

What did you expect to see?

Sub-second performance.

What did you see instead?

Multiple seconds to complete when identifiers in source are undefined, causing editor to hang during execution.

https://gist.github.com/sporkmonger/215a6c9d757cf2e8c466f4ac527f72d9

As requested in #17591.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions