go-python / go-python/gopy

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

Open
#381 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
136
Avg merge
14m
Merged PRs (30d)
2

Description

See example:
```go
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:
```go
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.