golang/go

x/tools/gopls: unnamed generics parameter formatted to be unparened and named in go2go

Closed this issue · 1 comments

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

$ go version
go version devel +ead7e9b351 Sat Aug 1 05:14:38 2020 +0000 linux/amd64
$ gopls version
golang.org/x/tools/gopls master
    golang.org/x/tools/gopls@v0.0.0-20200616205136-76e917206452 h1:0SxHeccMdwJg02GN5PuFGSus9SSmA6FFOpuyRTnjrac=

Does this issue reproduce with the latest release?

No(go2go development)

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/owner/.cache/go-build"
GOENV="/home/owner/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/owner/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/owner/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/owner/go2"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/owner/go2/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build789186970=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Save and format below file in VSCode. (I followed installation here)

package main

type iface(type T) interface {
}

type some(type T) struct {
	f func(T, iface(T))
}

What did you expect to see?

package main

type iface(type T) interface {
}

type some(type T) struct {
	f func(T, iface(T))
}

What did you see instead?

package main

type iface(type T) interface {
}

type some(type T) struct {
	f func(T, iface T)
}

Thank you for raising this issue. However it's unlikely that it will be resolved in the near future. gofmt has not been updated to work with the generics prototype, and it's unlikely it will be until after (and if) that proposal is accepted.