-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(go): version file in the generated module directory (#2492)
Since golang version isn't available anywhere inside the module, we embed a version file so that consumers can access the version. This is needed for publishing [go modules](cdklabs/publib#23) using `jsii-release` without the user having to supply the version externally. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
- Loading branch information
Showing
4 changed files
with
101 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { CodeMaker } from 'codemaker'; | ||
|
||
/** | ||
* Represents the version of the go module. This is needed because the version is not | ||
* available in standard go module files. | ||
*/ | ||
export class VersionFile { | ||
private static readonly NAME = 'version'; | ||
|
||
public constructor(private readonly version: string) {} | ||
|
||
public emit(code: CodeMaker) { | ||
code.openFile(VersionFile.NAME); | ||
code.line(this.version); | ||
code.closeFile(VersionFile.NAME); | ||
} | ||
} |
48 changes: 36 additions & 12 deletions
48
packages/jsii-pacmak/test/generated-code/__snapshots__/prerelease-identifiers.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
64 changes: 44 additions & 20 deletions
64
packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.