Skip to content
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

Upgrade golangci-lint to v1.64.5 #33654

Merged
merged 6 commits into from
Feb 20, 2025
Merged

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Feb 20, 2025

Use usetesting instead of deprecated tenv.

  1. Follow up Use test context in tests and new loop system in benchmarks #33648
  2. Make lint pass and add some comments

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 20, 2025
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 20, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/internal labels Feb 20, 2025
@wxiaoguang wxiaoguang added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Feb 20, 2025
@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 Feb 20, 2025
@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 Feb 20, 2025
@silverwind
Copy link
Member

I recommend also making it more strict and enable the default-disabled options:

linter-settings:
  usetesting:
    os-setenv: true
    os-temp-dir: true

@wxiaoguang
Copy link
Contributor Author

I recommend also making it more strict and enable the default-disabled options:

IIRC they are enabled by default, that's why it needs this change: 6a5111d

@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Feb 20, 2025

Hmm, I see that os-temp-dir is different, it defaults to false. Will try to see how many changes we need to do to enable it.

If there are too many changes, then leave it to a new PR

image


Update: now os-temp-dir is enabled. (os-setenv is enabled by default, so no need to touch it)

And applied suggestions from #33655 (comment) for the Makefile

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 20, 2025
@wxiaoguang wxiaoguang merged commit 3ee5ee2 into go-gitea:main Feb 20, 2025
26 checks passed
@GiteaBot GiteaBot added this to the 1.24.0 milestone Feb 20, 2025
@wxiaoguang wxiaoguang deleted the fix-golintci branch February 20, 2025 16:05
@silverwind
Copy link
Member

os-setenv is enabled by default, so no need to touch it

The docs say it's disabled by default. Is it a docs bug?

# Enable/disable `os.Setenv()` detections.
# Default: false
os-setenv: true

@TheFox0x7
Copy link
Contributor

I think it is. The rule triggered for me but I figured that all those context changes + loop are big enough for a PR.
That and I had no confidence in replacing it so I left it alone.
Though it is strange - they generate those docs from their code so it should be up to date, given that changelog is there for later versions so it should be updated.

@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Feb 20, 2025

os-setenv is enabled by default, so no need to touch it

The docs say it's disabled by default. Is it a docs bug?

# Enable/disable `os.Setenv()` detections.
# Default: false
os-setenv: true

I do not think it is a bug. We are using golangci, but not the standalone usetesting

(Update: hmm, maybe usetesting doc is out-dated and it is a bug)

https://golangci-lint.run/usage/linters/#usetesting

Also see the doc screenshot in #33654 (comment)

@silverwind
Copy link
Member

Opened ldez/usetesting#7

zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 21, 2025
* giteaofficial/main:
  Fix omitempty bug (go-gitea#33663)
  Upgrade golangci-lint to v1.64.5 (go-gitea#33654)
  Fix mCaptcha bug (go-gitea#33659)
  Update Go dependencies (skip blevesearch, meilisearch) (go-gitea#33655)
  Use test context in tests and new loop system in benchmarks (go-gitea#33648)
  Add missed changelogs (go-gitea#33649)
  [skip ci] Updated translations via Crowdin
  git graph: don't show detached commits (go-gitea#33645)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code modifies/internal size/M Denotes a PR that changes 30-99 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants