Fix usage of "Deprecated" godoc comments#1767
Fix usage of "Deprecated" godoc comments#1767alexbozhenko wants to merge 3 commits intonats-io:mainfrom
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 <alexbozhenko@gmail.com>
Signed-off-by: Alex Bozhenko <alexbozhenko@gmail.com>
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
Deprecatedbadge 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: