Skip to content

Compile error when a function parameter name is same with package name #381

Description

@SuperScript-PRC

See example:

package packet

func GoPacketToBytes(shieldID int, packet Packet) ([]byte, error) { // gopy bug
	buf := bytes.NewBuffer([]byte{})
	w := protocol.NewWriter(buf, int32(shieldID))
	packet.Marshal(w)
	return buf.Bytes(), nil
}

Use gopy build it will generate Go file which includes:

        packet.GoPacketToBytes( ... )

which causes compile problem.
Rename parameter packet could solve it, but it's better to fix this problem since the error log is weird to greenhands.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions