diff --git a/astutil/imports.go b/astutil/imports.go index c3128103..1675aa62 100644 --- a/astutil/imports.go +++ b/astutil/imports.go @@ -1,3 +1,7 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + // Package astutil contains common utilities for working with the Go AST. package astutil diff --git a/astutil/imports_test.go b/astutil/imports_test.go index 27f69979..774811cc 100644 --- a/astutil/imports_test.go +++ b/astutil/imports_test.go @@ -1,3 +1,7 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package astutil import ( diff --git a/go/types/typestring.go b/go/types/typestring.go index 77323415..9f4905c2 100644 --- a/go/types/typestring.go +++ b/go/types/typestring.go @@ -115,8 +115,9 @@ func WriteType(buf *bytes.Buffer, this *Package, typ Type) { s = "<-chan " default: s = "chan " - if c, _ := t.elem.(*Chan); c != nil { - parens = c.dir == ast.RECV + // chan (<-chan T) requires parentheses + if c, _ := t.elem.(*Chan); c != nil && c.dir == ast.RECV { + parens = true } } buf.WriteString(s)