go-python / go-python/gopy

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

Offen
#381 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
2.3k
Forks
136
Ø Merge
14 Min.
Gemergte PRs (30 T.)
2

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.