Skip to content

go/ast: deprecate MergePackageFiles (it's not used, and buggy) #7124

@gopherbot

Description

@gopherbot

by [email protected]:

The parser.ParseComments option to parser.ParseFile
causes ast.MergePackageFiles to create a broken merge.

What steps will reproduce the problem?
  This code reproduces the problem:
  http://play.golang.org/p/63LsxcrpWi
  You can also run godoc with --src option for a package with multiple source files, like strings.

What is the expected output?
  // Package foo does bar and baz.
  package foo

  type string struct{}

  // Foo is a structure.
  type Foo struct{}

  // String outputs Foo in a human-readable way.
  func (f *Foo) String() string { return string{} }

  // Error method for Foo.
  func (f *Foo) Error() string { return f.String() }


What do you see instead?
  package

  // Foo is a structure.
  foo

  type string struct{}

  type Foo struct{}

  // String outputs Foo in a human-readable way.

  // Package foo does bar and baz.

  // Error method for Foo.

  func (f *Foo) String() string { return string{} }

  func (f *Foo) Error() string { return f.String() }

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Accepted

Relationships

None yet

Development

No branches or pull requests

Issue actions