-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: initial jsii-srcmak work for golang #342
Conversation
Signed-off-by: campionfellin <campionfellin@gmail.com>
if (!outdir) { throw new Error('--golang-outdir is required'); } | ||
if (!module) { throw new Error('--golang-module is required'); } | ||
return { | ||
// moduleKey: module, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where you could explicitly set moduleKey
for golang
but then it breaks other languages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @campionfellin, could you elaborate on how it breaks the other languages? I tried it locally and it seemed to still work. I'd think it shouldn't matter to JSII whether there's a random hash or some actual name if the result does not contain that hash/name anyway? Did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't quite remember here... I think it had something to do with moduleKey
needing to be a random hash for some languages, but needed to be named for go
. Perhaps I just couldn't figure it out at the time, but now it sounds like it's working for you!
This PR extends the work done in #342 by @campionfellin JSII now supports specifying a `packageName` for Golang (which resolves the issues Campion mentioned in his [PR](#342 (comment))). I added `packageName` as a required parameter for this library (although it [isn't required](https://aws.github.io/jsii/user-guides/lib-author/configuration/targets/go/) when using JSII directly). I also looked into passing the generated `moduleKey` from `compile()` back to `srcmak()` but ditched that completely as the generated Go package would be named with the generated hash. And I don't think anyone would actually want to use it that way. So I decided to keep it simple and make the `packageName` required instead.
Superseded by #476 |
Starting off with some
golang
stuff here... some interesting issues with themoduleKey
that I haven't seen before.. it seems to be required input (rather than optional previously).JSII I think gets the output directory from
name
here:https://github.com/aws/jsii-srcmak/blob/37bc954923b8b5dd076eec8412ffe646c1dca4be/src/compile.ts#L54-L57
And in JSII:
https://github.com/aws/jsii/blob/32c0add5edd0ed57d535241b483168e2b7e731ce/packages/jsii-pacmak/lib/targets/go.ts#L146-L151
Which somewhat makes sense, but when using the
jsii-srcmak
CLI, you usually don't put in themoduleKey
explicitly, ending with it being a random hash:So my
dist
folder looks like:I think JSII should probably base the
outdir
onmoduleName
input... will poke around there to see what I can doSigned-off-by: campionfellin campionfellin@gmail.com