-
Notifications
You must be signed in to change notification settings - Fork 709
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
Fix usage of "Deprecated" godoc comments #1767
base: main
Are you sure you want to change the base?
Conversation
c427f57
to
4c6b4bc
Compare
@piotrpio Now linting fails with the following. How do you recommend dealing with it?
Just add a bunch of lint:ignores? https://staticcheck.dev/docs/configuration/#line-based-linter-directives |
I think so, since these are tests for this deprecated method (and we're not using it outside of those tests), so |
https://github.com/golang/pkgsite/blob/master/internal/godoc/dochtml/deprecated_test.go#L14 Examples of Deprecations: https://pkg.go.dev/net/http#pkg-variables Signed-off-by: Alex Bozhenko <[email protected]>
Signed-off-by: Alex Bozhenko <[email protected]>
4c6b4bc
to
c9acd5a
Compare
@piotrpio Thanks! Ready for review. |
eh, now golangci-lint picks it up... And that requires a different directive: Should we get rid of separate statickcheck run, and let golangci-lint handle all the linting? |
I'm afraid we'll have many more linting errors in |
We've also agreed to keep our linting close to reasonable as just what go standard formatting would require + static check + vet. So enabling the additional lints will just cause a bunch of needless code cancer for no benefit. |
I would strongly vote to remove golang-ci from here, what makes go great is that everyone agrees on a basic styles and validations - adding golang-ci here is a hurdle everyone has to jump and as we see we enter a cycle of adding code for no purpose than to make the linters happy. We had calls around this a few months ago and agreed to remove additional tests over vet and staticcheck |
So, because staticcheck command runs on the entire repo, and then golangci-lint config includes staticcheck, we would have to add two ignore directives, as I showed here: What I meant is not to change the linter config, but change how the linting is run(#1774), so e.g. deprecated code would need only a single directive for golangci:
So please advice what to do in this PR. Should we just add two directives, |
c198985
to
5baa151
Compare
There couple of places where Deprecated was not on a separate paragraph. Fix it.
From https://go.dev/blog/godoc
Also:
https://github.com/golang/pkgsite/blob/master/internal/godoc/dochtml/deprecated_test.go#L14
Even though in pkgsite
Deprecated
badge is added only for functions, it still makes sense to have it on a separate paragraph for variables, etc..E.g. a deprecated Variable from here:
https://pkg.go.dev/net/http#pkg-variables
Shows up in strike-through font in vscode:
There probably should be a linter for this, but I have not found one...
This shows all the deprecations are on separate paragraph now: