gopy doesn't ignore internal package
Sanix-Darker opened this issue · 2 comments
Hi there, first of all, am a big fan of this project, i was working on creating go bindings to python recently(https://github.com/Sanix-Darker/go_bind) and in a more real life project, i wanted to bind the the authzed-go project but i found myself on some issues...
A little similar to #259 ,
Am trying to pkg, but i get :
--- building package ---
gopy pkg -author=dk -output=py_build -vm=python3 -symbols=true -name=authz_go_for_py -exclude=google.golang.org/grpc/internal/serviceconfig -dynamic-link=true -url=github.com/sanix-darker/authzed-go -version=0.0.1 github.com/sanix-darker/authzed-go/proto/authzed/api/v1/
goimports -w authz_go_for_py.go
go build -mod=mod -buildmode=c-shared -o authz_go_for_py_go.so .
cmd had error: exit status 1 output:
package github.com/sanix-darker/authzed-go/py_build/authz_go_for_py
authz_go_for_py.go:80:2: use of internal package google.golang.org/grpc/internal/serviceconfig not allowed
Even tho i excluded the internal... it's still telling me it's not allowed...
Am on go1.20
.
any idea on how to ignore this please ?
Thanks 🙏🏽
I suspect the problem is that it is only looking for immediate subdir names. The relevant code is in cmd_pkg.go:165
:
// now try all subdirs
dir, _ := filepath.Split(gofiles[0])
drs := Dirs(dir)
for _, dr := range drs {
_, ex := exmap[dr]
if ex || dr[0] == '.' || dr[0] == '_' {
continue
}
sp := filepath.Join(path, dr)
buildPkgRecurse(odir, sp, rootpath, exmap, buildTags)
}
I'm pushing a change that automatically excludes internal
packages (along with the existing exclusion of _
prefix dirs) -- but you can just add internal
to excludes as a workaround for now and it should work.
Thanks for taking care of this 🙏🏽