Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pacmak: go and python module with only submodules (no direct types) fails compilation #2619

Closed
2 of 5 tasks
eladb opened this issue Feb 28, 2021 · 1 comment · Fixed by #2622
Closed
2 of 5 tasks
Assignees
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@eladb
Copy link
Contributor

eladb commented Feb 28, 2021

🐛 Bug Report

Affected Languages

  • Golang
  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)

General Information

  • JSII Version: 1.22.0
  • Platform: any

What is the problem?

When a module does not have any direct types, only exports a bundle of other submodules, the resulting go code includes unused imports statements.

In python, the module will include an empty __all__ list which mypy doesn't like.

Verbose Log

Error is:

nodirect/nodirect.go:4:2: imported and not used: "github.com/aws/jsii-runtime-go" as _jsii_
nodirect/nodirect.go:5:2: imported and not used: "github.com/aws/jsii/jsii-calc/go/jsiicalc/v3/jsii" as _init_

In python:

Need type annotation for '__all__' (hint: "__all__: List[<type>] = ..."
@eladb eladb added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 28, 2021
@eladb eladb self-assigned this Feb 28, 2021
@eladb eladb changed the title pacmak: go module with only submodules (no direct types) fails compilation pacmak: go and python module with only submodules (no direct types) fails compilation Feb 28, 2021
eladb pushed a commit that referenced this issue Feb 28, 2021
The `go build` command we run during pacmak did not descend into submodules. After adding `./...` to the `go build` command, a few other issues were surfaced related to static member handling. 

The common issue was that `GoClass` had two separate lists (for static and non-static methods/props). This caused various places in the implementation to only take into account non-static members. Added a new list called `members` which collected both static and non-static members and used it in the various dependency props.

An empty module in Python (with only submodules) will result in an empty `__all__` list which yields a MyPy error.

Fixes #2618 - go build does not build submodule directories
Fixes #2619 - go/python module with only submodules (no direct types) fails compilation
Fixes #2620 - go missing imports if class includes only static members
Fixes #2621 - invalid go imports when types referenced by static members
eladb pushed a commit that referenced this issue Mar 1, 2021
The `go build` command we run during pacmak did not descend into submodules. After adding `./...` to the `go build` command, a few other issues were surfaced related to static member handling. 

The common issue was that `GoClass` had two separate lists (for static and non-static methods/props). This caused various places in the implementation to only take into account non-static members. Added a new list called `members` which collected both static and non-static members and used it in the various dependency props.

An empty module in Python (with only submodules) will result in an empty `__all__` list which yields a MyPy error.

Fixes #2618 - go build does not build submodule directories
Fixes #2619 - go/python module with only submodules (no direct types) fails compilation
Fixes #2620 - go missing imports if class includes only static members
Fixes #2621 - invalid go imports when types referenced by static members
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

This was referenced Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant