go-python / go-python/gopy

Type aliases points to the underlying type not the root one, this cause issues where the autogenerated go package does not build if it links to internal packages.

Offen
#348 4 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

I have code like this:
```
.
├── a.go
├── b
│   ├── b.go
│   └── internal
│   └── internal.go
└── go.mod
```
```go
// a.go
package a

import "a/b"

type A = b.B
```
```go
// b.go
package b

import "a/b/internal"

type B = internal.I
```
```go
// internal.go
package internal

import "strconv"

type I uint

func (i I) String() string { return strconv.FormatUint(uint64(i), 10) }
```
`gopy pkg a` then creates a folder `a/a` and tries to import `a/b/internal` which does not work because it's not allowed to import an internal package.

My real world usecase is some existing librairy with type alias chains going through multiple modules.

I think this could be solved with the `GODEBUG=gotypesalias=1` https://pkg.go.dev/go/types#Alias but I'm not familiar with the gopy codebase.

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.