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

Go: multi-line comments result in invalid go code #2457

Closed
1 task done
eladb opened this issue Jan 21, 2021 · 1 comment · Fixed by #2462
Closed
1 task done

Go: multi-line comments result in invalid go code #2457

eladb opened this issue Jan 21, 2021 · 1 comment · Fixed by #2462
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 Jan 21, 2021

🐛 Bug Report

Affected Languages

  • golang

General Information

  • JSII Version: 1.17.1

What is the problem?

When generating go code from a module that includes multi-line comments (e.g. aws/constructs), the generated code is invalid.

For example, this typescript code:

  /**
   * All parent scopes of this construct.
   *
   * @returns a list of parent scopes. The last element in the list will always
   * be the current construct and the first element will be the root of the
   * tree.
   */
  public get scopes(): IConstruct[] { ... }

Results in this go code:

	// All parent scopes of this construct.
	//
	// Returns: a list of parent scopes. The last element in the list will always
be the current construct and the first element will be the root of the
tree.
	Scopes []IConstructIface `json:"scopes"`

As you can see, we need to add // prefix to the multiline @returns docstring.

Verbose Log

./constructs.go:457:8: syntax error: unexpected current, expecting semicolon or newline or }
./constructs.go:459:10: syntax error: unexpected ] after top level declaration
@eladb eladb added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 21, 2021
eladb pushed a commit that referenced this issue Jan 21, 2021
Split multi-line comments and prefix with `//` so they are rendered correctly.

Fixes #2457
@mergify mergify bot closed this as completed in #2462 Jan 21, 2021
mergify bot pushed a commit that referenced this issue Jan 21, 2021
…ts (#2462)

Split multi-line comments and prefix with `//` so they are rendered correctly.

Fixes #2457



---

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
@github-actions
Copy link
Contributor

⚠️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.

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