aws / aws/jsii

Cannot consume generated Go library that has peer dependency on multiple major versions

Open
#3,263 0 comments 0 reactions 0 assignees View on GitHub
bug p2
Dominant language
TypeScript
Stars
2.9k
Forks
267
Avg merge
1d 25m
Merged PRs (30d)
14

Description

## :bug: Bug Report

### Affected Languages

- [ ] `TypeScript` or `Javascript`
- [ ] `Python`
- [ ] `Java`
- [ ] .NET (`C#`, `F#`, ...)
- [x] `Go`

### General Information
* **JSII Version:** 1.47.0 (build 86d2c33), typescript 3.9.10
* **Platform:** macOS 11.6.1

### What is the problem?

If my construct library declares a peer dependency on multiple major versions of another JSII library (e.g. `"constructs": "<=10.x"` in package.json) then jsii-pacmak will successfully package the library to Go, but the Go library will not be usable with e.g. constructs-go v3. The reason for this is that Go does not support version ranges.

I would expect to receive a compiler warning or packaging warning from jsii to prevent me from specifying peer dependencies like this.

Discovered in https://github.com/cdk8s-team/cdk8s/issues/790

### Verbose Log

Cannot use 'scope' (type "github.com/aws/constructs-go/constructs/v3".Construct) as the type "github.com/aws/constructs-go/constructs/v10".Construct Type does not implement 'constructs.Construct'

Contributor guide

Open the contributing guide

Research direction

Start with the package.json peer dependency example and the jsii-pacmak packaging path, then reproduce the generated Go library failure using constructs-go v3 and v10. Done means the incompatible multi-major peer dependency is detected and a compiler or packaging warning clearly explains the problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.