Skip to content

x/tools/cmd/goimports: adds flag control to delete extra blank lines before grouping #43193

@QianChenglong

Description

@QianChenglong

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

$ go version
go version go1.15.2 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/chenglong/Library/Caches/go-build"
GOENV="/Users/chenglong/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/chenglong/go/pkg/mod"
GONOPROXY="tkestack.io,k8s.io,git.code.oa.com"
GONOSUMDB="tkestack.io,k8s.io,git.code.oa.com"
GOOS="darwin"
GOPATH="/Users/chenglong/go"
GOPRIVATE="tkestack.io,k8s.io,git.code.oa.com"
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/Cellar/go/1.15.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/20/n4jpmhjs0hd9hjxg80yr2nww0000gn/T/go-build993050189=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

use goimports to format file.

current:
image

What did you expect to see?

Blank lines cause incorrect grouping. These blank lines are automatically generated by IDE.

What did you see instead?

Delete extra blank lines and regroup:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis 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