You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Has something to do with the input being multiline.
$ cat x.go
package main
func f(...interface{})
func (t *T) f(...interface{})
func f1(...interface{m();n()})
func (t *T) f1(...interface{m();n()})
$ gofmt x.go
package main
func f(...interface{})
func (t *T) f(...interface{})
func f1(...interface {
m()
n()
})
func (t *T) f1(...interface {
m()
n()
})
(So far so good!)
$ gofmt x.go | gofmt
package main
func f(...interface{})
func (t *T) f(...interface{})
func f1(...interface {
m()
n()
},)
func (t *T) f1(...interface {
m()
n()
},)
Oops, this time we got some extra commas.
6g rejects this last version, because the ... must be last. If the trailing comma is
allowed, which I think it is, then that's a bug in 6g too. Will file a different bug for
that.
The text was updated successfully, but these errors were encountered:
This is unrelated to ... . It's simply an idempotency issue. The following programs show
the same behavior:
cat x.go:
package main
func f0(interface{})
func f1(interface{m()})
cat x.go | gofmt
package main
func f0(interface{})
func f1(interface {
m()
})
cat x.go | gofmt | gofmt
package main
func f0(interface{})
func f1(interface {
m()
},)
and:
cat x.go
package main
func f0(struct{})
func f1(struct{x int; y int})
cat x.go | gofmt
package main
func f0(struct{})
func f1(struct {
x int
y int
})
cat x.go | gofmt | gofmt
package main
func f0(struct{})
func f1(struct {
x int
y int
},)
The resulting program is not incorrect: parameters may always end in a comma
(http://tip.golang.org/ref/spec#Parameters).
The text was updated successfully, but these errors were encountered: