Skip to content

Add missing //nolint:depguard#37162

Merged
silverwind merged 2 commits intogo-gitea:mainfrom
silverwind:fix-depguard-nolint
Apr 10, 2026
Merged

Add missing //nolint:depguard#37162
silverwind merged 2 commits intogo-gitea:mainfrom
silverwind:fix-depguard-nolint

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Apr 9, 2026

When running golangci-lint without GOEXPERIMENT=jsonv2, a lint error import 'encoding/json' is not allowed is seen.

All other files in the module that import encodings/json have //nolint already, so add it.


This PR was written with the help of Claude Opus 4.6

The other files in modules/json already have //nolint:depguard comments,
but jsonlegacy.go was missing it. This causes a lint error when running
golangci-lint without GOEXPERIMENT=jsonv2 (which the Makefile sets).

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 9, 2026
@silverwind silverwind added the backport/v1.26 This PR should be backported to Gitea 1.26 label Apr 9, 2026
@silverwind silverwind requested a review from Copilot April 9, 2026 19:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the missing //nolint:depguard annotation in the legacy JSON implementation so golangci-lint passes when GOEXPERIMENT=jsonv2 is not enabled (matching the pattern used by the other modules/json implementations).

Changes:

  • Annotate the encoding/json import in modules/json/jsonlegacy.go with //nolint:depguard to satisfy depguard lint rules in non-jsonv2 builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 9, 2026
@silverwind silverwind changed the title Add missing nolint:depguard to jsonlegacy.go Add missing //nolint:depguard Apr 9, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 10, 2026
@silverwind silverwind enabled auto-merge (squash) April 10, 2026 10:09
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 10, 2026
@silverwind silverwind merged commit 681c407 into go-gitea:main Apr 10, 2026
26 checks passed
@silverwind silverwind deleted the fix-depguard-nolint branch April 10, 2026 10:39
@GiteaBot GiteaBot added this to the 1.27.0 milestone Apr 10, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 10, 2026
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Apr 10, 2026
When running `golangci-lint` without `GOEXPERIMENT=jsonv2`, a lint error
`import 'encoding/json' is not allowed` is seen.

All other files in the module that import `encodings/json` have
`//nolint` already, so add it.

---
This PR was written with the help of Claude Opus 4.6

Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Apr 10, 2026
silverwind added a commit that referenced this pull request Apr 10, 2026
Backport #37162 by @silverwind

When running `golangci-lint` without `GOEXPERIMENT=jsonv2`, a lint error
`import 'encoding/json' is not allowed` is seen.

All other files in the module that import `encodings/json` have
`//nolint` already, so add it.

---
This PR was written with the help of Claude Opus 4.6

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 14, 2026
* main:
  Add comment for the design of "user activity time" (go-gitea#37195)
  fix(api): handle missing base branch in PR commits API (go-gitea#37193)
  Refactor htmx and fetch-action related code (go-gitea#37186)
  Fix encoding for Matrix Webhooks (go-gitea#37190)
  Always show owner/repo name in compare page dropdowns (go-gitea#37172)
  fix(api): handle fork-only commits in compare API (go-gitea#37185)
  Improve Contributing docs and set a release schedule (go-gitea#37109)
  Update Nix flake (go-gitea#37183)
  Remove outdated RunUser logic (go-gitea#37180)
  Refactor flash message and remove SanitizeHTML template func (go-gitea#37179)
  Indicate form field readonly via background (go-gitea#37175)
  Remove dead CSS rules (go-gitea#37173)
  Fix flaky `TestCatFileBatch/QueryTerminated` test (go-gitea#37159)
  Implement logout redirection for reverse proxy auth setups (go-gitea#36085)
  Add missing `//nolint:depguard` (go-gitea#37162)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/done All backports for this PR have been created backport/v1.26 This PR should be backported to Gitea 1.26 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants