Skip to content

Upgrade golangci-lint to v1.64.5#33654

Merged
wxiaoguang merged 6 commits into
go-gitea:mainfrom
wxiaoguang:fix-golintci
Feb 20, 2025
Merged

Upgrade golangci-lint to v1.64.5#33654
wxiaoguang merged 6 commits into
go-gitea:mainfrom
wxiaoguang:fix-golintci

Conversation

@wxiaoguang
Copy link
Copy Markdown
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
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 and removed size/S labels Feb 20, 2025
@wxiaoguang wxiaoguang merged commit 3ee5ee2 into go-gitea:main Feb 20, 2025
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators May 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. 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