Skip to content

x/tools/cmd/goimports: lost line between package and import statements in output #26921

@sergeleger

Description

@sergeleger

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.3 linux/amd64

Does this issue reproduce with the latest release?

Yes with go1.10.3 and the following commits:

golang.org/x/tools/imports: 8cb83b71b42ccf5fe279fa8a24a6a8f65507dc9c
golang.org/x/tools/cmd/goimports: 059bec968c61383b574810040ba9410712de36c5

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/legers/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/legers/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/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-build017712154=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Very similar to issue #26290, but no initial import statement.

$ cat x.go
package p // comment

// T does something useful.
func T() {
    var _ = fmt.Printf
}

$ goimports x.go
package p // comment

import "fmt" // T does something useful.
func T() {
	var _ = fmt.Printf
}

A blank line should have been inserted after the new import statement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions