Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: migrate from tenv linter to usetesting linter#20401

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zedkipp merged 1 commit intomainfromzedkipp/usetesting-migrate
Oct 21, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion.golangci.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -169,6 +169,16 @@ linters-settings:
- name: var-declaration
- name: var-naming
- name: waitgroup-by-value
usetesting:
# Only os-setenv is enabled because we migrated to usetesting from another linter that
# only covered os-setenv.
os-setenv: true
os-create-temp: false
os-mkdir-temp: false
os-temp-dir: false
os-chdir: false
context-background: false
context-todo: false

# irrelevant as of Go v1.22: https://go.dev/blog/loopvar-preview
govet:
Expand DownExpand Up@@ -252,7 +262,6 @@ linters:
# - wastedassign

- staticcheck
- tenv
# In Go, it's possible for a package to test it's internal functionality
# without testing any exported functions. This is enabled to promote
# decomposing a package before testing it's internals. A function caller
Expand All@@ -265,4 +274,5 @@ linters:
- typecheck
- unconvert
- unused
- usetesting
- dupl
5 changes: 1 addition & 4 deletionscoderd/util/tz/tz_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,12 +35,9 @@ func Test_TimezoneIANA(t *testing.T) {
// This test can be flaky on some Windows runners :(
t.Skip("This test is flaky under Windows.")
}
oldEnv, found := os.LookupEnv("TZ")
_, found := os.LookupEnv("TZ")
if found {
require.NoError(t, os.Unsetenv("TZ"))
t.Cleanup(func() {
_ = os.Setenv("TZ", oldEnv)
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thisos.Setenv call is flagged by the new linter. It's not needed because thet.Setenv call in this test cleans up the environment for ushttps://pkg.go.dev/testing#T.Setenv

})
}

zone, err := tz.TimezoneIANA()
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp