Skip to content

Extract Go comments from "main" package too - #133

Open
vzxv wants to merge 1 commit into
invopop:mainfrom
vzxv:comments-from-main
Open

Extract Go comments from "main" package too#133
vzxv wants to merge 1 commit into
invopop:mainfrom
vzxv:comments-from-main

Conversation

@vzxv

@vzxv vzxv commented Feb 6, 2024

Copy link
Copy Markdown

ExtractGoComments() uses the fully-qualified package path when creating keys in our CommentMap, but we perform lookups in that map using keys constructed using (reflect.Type)PkgPath(). The latter method always returns "main" for types defined in the "main" package, rather than a fully-qualified package path, so those lookups fail. The result is that we never incorporate comments into a schema for types defined in "main".

Update ExtractGoComments() to handle the special case of "main".

@vzxv
vzxv force-pushed the comments-from-main branch from d8b615b to 801c3aa Compare February 6, 2024 03:00
ExtractGoComments() uses the fully-qualified package path when creating
keys in our CommentMap, but we perform lookups in that map using keys
constructed using (reflect.Type)PkgPath(). The latter method always
returns "main" for types defined in the "main" package, rather than a
fully-qualified package path, so those lookups fail. The result is that
we never incorporate comments into a schema for types defined in "main".

Update ExtractGoComments() to handle the special case of "main".
@vzxv
vzxv force-pushed the comments-from-main branch from 801c3aa to df70a74 Compare February 6, 2024 03:01
@samlown samlown added the needs tests Not enough tests for this to be accepted label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs tests Not enough tests for this to be accepted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants