Skip to content

cmd/go: reject adding methods in _test.go file #6204

Closed
@remyoudompheng

Description

@remyoudompheng
What steps will reproduce the problem?
1. Extract bug.tar.gz into $GOPATH/src
2. Run "go test p2"

What is the expected output? What do you see instead?

Expected: "PASS"

Instead:

# testmain
/opt/remy/go/pkg/tool/linux_amd64/6l: conflicting definitions for @"p2".Secret
/tmp/go-build276558121/p2/_test/p2_test.a(_go_.6):  type @"p2".Secret struct {
@"p2".field []uint64 }
    func (@"p2".f·2 *@"p2".Secret "esc:0x0") Bits () (? []uint64) { return @"p2".f·2.@"p2".field }
/tmp/go-build276558121/p1.a(_go_.6):    type @"p2".Secret struct {
@"p2".field []uint64 }
FAIL    p2 [build failed]

The example combines:
- a export_test.go to add an exported method to a type for tests
- a p2_test package that depends on p1 which depends on p2.

Attachments:

  1. bug.tar.gz (606 bytes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions