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: cgo "//export" usage missing crucial info #56853

Open
HinTak opened this issue Nov 19, 2022 · 0 comments
Open

cmd/cgo: cgo "//export" usage missing crucial info #56853

HinTak opened this issue Nov 19, 2022 · 0 comments
Labels
Documentation help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@HinTak
Copy link

HinTak commented Nov 19, 2022

What is the URL of the page with the issue?

https://pkg.go.dev/cmd/cgo

About "//export".

While the example code itself shows correct usage, the paragraph surrounding it doesn't say two things you should NOT do:

  1. Other "functional" comments in cgo allows beginning white spaces. Thus, for readability, one does (with a space between "//" and "#")
// #cgo pkg-config: ...

"//export" does not allow a space between. It is also extremely difficult to find out when the space should be deleted for this to work as intended. (A suitable warning if "// export ..." is used?)

  1. The other less important thing is trailing garbage/comments. Though a suitable error is emitted, it would be nice to be able to do have trailing comments like this:
//export MyRoutine // used by MyOtherProject
  1. It is also not clear whether the "//export MyRoutine" and the next line "func MyCoolRoutine ..." name must match. One might want to name routines by Go convention in Go code, but export as a different name following C code's naming conventions, for example?

What is your user agent?

Screenshot

What did you do?

What did you expect to see?

What did you see instead?

@HinTak HinTak added the pkgsite label Nov 19, 2022
@gopherbot gopherbot added this to the Unreleased milestone Nov 19, 2022
@ianlancetaylor ianlancetaylor changed the title x/pkgsite: cgo "//export" usage missing crucial info cmd/cgo: cgo "//export" usage missing crucial info Nov 20, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 20, 2022
@ianlancetaylor ianlancetaylor added Documentation help wanted NeedsFix The path to resolution is known, but the work has not been done. and removed pkgsite compiler/runtime Issues related to the Go compiler and/or runtime. labels Nov 20, 2022
@ianlancetaylor ianlancetaylor modified the milestones: Unreleased, Backlog Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants