-
Notifications
You must be signed in to change notification settings - Fork 42
godoclint: upgrade and pin to v0.3.0 #1558
Description
Hi Team, I'm the author of godoc-lint, and discovered this repo thanks to @julieqiu's valuable feedback (See this issue). Super excited that the linter is helping out here 🚀, and that's why I felt responsible to share some thoughts to enhance the experience and also to prevent you from any potential headaches down the road.
Here are a couple of things I wanted to highlight:
-
The issue mentioned above is now fixed, and I think you can now have an idiomatic godoc for the
mainpackage (atcmd/librarian/main.go) without the need to exclude the path from the linter. I tested this change on my clone ofgoogleapis/librarianand it seems working. Kudos to @julieqiu for reporting this! 🙏 -
Since the linter is still in its
v0days 🍼, I recommend pinning it atv0.3.0(current latest) to safeguard the project against any future breaking changes. I always tend to keep it backwards compatible, but still it'sv0. That said, I'll ping you folks in the future about new features that might be interested for you. -
I noticed the
TestExportedSymbolsHaveDocsfunction inall_test.goensures all exported symbols (except consts) have godocs. Godoc-Lint can help you with this as well if therequire-docrule is enabled. When this rule is enabled, the linter will check that exported symbols (excluding tests) have godoc (regardless of the format/phrasing). You just need to call the linter like this:go run github.com/godoc-lint/godoc-lint/cmd/[email protected] -enable require-doc -exclude '\.pb\.go$' -exclude 'internal/sidekick' ./...
Just note that:
- This has to be a separate call; i.e. not to be mixed with the one used in
TestGodocLintsince the exclusions are just meant to be made for therequire-docrule. - It will also check
constdeclarations which is not already covered inTestExportedSymbolsHaveDocs. However, as I checked the test passes since all exportedconsts have godocs, and it seems like a good idea to me to include them in the check.
- This has to be a separate call; i.e. not to be mixed with the one used in
All said, I'll be thrilled to contribute to googleapis/librarian if you see value in any of the suggestion above.