go-python / go-python/gopy

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

未关闭
#381 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
2.3k
派生
136
平均合并
14 分钟
30 天内合并 PR
2

描述

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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

使用提供的示例运行 gopy build,并检查其中生成 packet.GoPacketToBytes(...) 的 Go wrapper。跟踪函数参数名称和包引用的处理方式;当参数名称与包名称匹配时,生成的文件能够编译即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
go, python
领域
tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。