Skip to content

cmd/gofmt: inconsistent formatting of spacing around operators #34426

@engineering-this

Description

@engineering-this

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

$ go version
go version go1.12.9 linux/amd64

Does this issue reproduce with the latest release?

Yes, tested with format button on https://play.golang.org/p/Ei6Hu4QqAHa

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/{username}/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/{username}/go"
GOPROXY=""
GORACE=""
GOROOT="/snap/go/4301"
GOTMPDIR=""
GOTOOLDIR="/snap/go/4301/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build430600410=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Operators inside function calls are inconsistently formatted depending if they are inside append or not.

What did you expect to see?

  bar := []int{
    baz(1 * 2),
  }
  bar = append(bar,
    baz(1 * 2),
  )

What did you see instead?

  bar := []int{
    baz(1 * 2),
  }
  bar = append(bar,
    baz(1*2),
  )

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.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions