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

cmd/cgo: recognize //go:export like //export #38785

Open
nd opened this issue May 1, 2020 · 7 comments
Open

cmd/cgo: recognize //go:export like //export #38785

nd opened this issue May 1, 2020 · 7 comments
Milestone

Comments

@nd
Copy link
Contributor

@nd nd commented May 1, 2020

Directives are excluded from extracted docs (#37974). In addition to comments matched by the //[a-z0-9]+:[a-z0-9] pattern, the //line comment is excluded. Maybe the CGO //export comment should be excluded as well.

@mvdan
Copy link
Member

@mvdan mvdan commented May 1, 2020

I think you meant #37974?

@mvdan mvdan changed the title To exclude CGO //export directive from extracted docs go/doc: exclude CGO //export directive from extracted docs May 1, 2020
@nd
Copy link
Contributor Author

@nd nd commented May 1, 2020

Thanks, fixed

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented May 1, 2020

@rsc @griesemer Any concerns about handling //export in doc comments as we handle //go: comments? I guess this would be a one-off special case.

Another option would be to migrate toward //go:export comments.

@ianlancetaylor ianlancetaylor added this to the Go1.15 milestone May 1, 2020
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented May 1, 2020

Setting Go1.15 milestone since this functionality is new in the 1.15 release. It can be done later, though.

@griesemer
Copy link
Contributor

@griesemer griesemer commented May 1, 2020

Wouldn't one want to see //export comments in documentation? How would one be able to tell that the marked Go function can be used from C?

But assuming that excluding these comments in the documentation is ok, moving to //go:export would not require another special case which I think would be preferable. The tools would have to recognize both indefinitely (or at least for a some time), but over time the //export comments would disappear in the documentation as code is adjusted. Does that sound about right?

@ianlancetaylor ianlancetaylor changed the title go/doc: exclude CGO //export directive from extracted docs cmd/cgo: recognize //go:export like //export Jun 26, 2020
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 26, 2020

Changing this into a cmd/cgo change to use //go:export.

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 2, 2020

Change https://golang.org/cl/240777 mentions this issue: cmd/cgo: recognize //go:export like //export

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.