Skip to content

x/tools/cmd/goimports: 21+ chars struct field breaks indentation for next lines #27177

@cixtor

Description

@cixtor

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes, as of today.

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/yorman/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/yorman"
GORACE="log_path=stderr exitcode=66"
GOROOT="/usr/local/opt/go/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gy/scj0933963ggbfdxcn5c91vw0000gn/T/go-build529046567=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Pay attention to lines 23 and 24 in the following code snippets:

• Correct formatting: https://play.golang.org/p/NHH57Ucegxa
• Incorrect formatting: https://play.golang.org/p/MgCpu-Ux5B5

What did you expect to see?

Values for the struct fields after line 23 should be placed in the same column as line 23.

What did you see instead?

All values for the struct fields after line 23 (which contains a field name with more than 21 characters) are using a different indentation as the previous lines, consequently breaking the formatting for the whole block of code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions