diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-05 10:28:45 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-06 08:56:49 +0300 |
commit | a0a6909272c900ee0a67a1ee0624638ef5fd3b46 (patch) | |
tree | f59640324bfb6bc1570a039721454b5b77619e09 /.golangci.yml | |
parent | f980e468853745fef7cf8d0a83623eda4646e54d (diff) |
golangci-lint: Disable use of `os.Setenv()` and `os.Unsetenv()` in testspks-go-v1.17-infrastructure
Disallow use of `os.Setenv()` and `os.Unsetenv()` in tests. Callers
should instead use `testhelper.ModifyEnvironment()`. Adjust existing
callers to do so. Note: the log tests cannot use the testhelper package
due to a cyclic import and thus use `t.Setenv()` directly.
Diffstat (limited to '.golangci.yml')
-rw-r--r-- | .golangci.yml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/.golangci.yml b/.golangci.yml index 4ef4e7da7..db6ed2d7e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -58,6 +58,12 @@ linters-settings: # they're tested as expected. - ^context.Background$ - ^context.TODO$ + # Tests should not set the bare environment functions, but instead use + # `testhelper.ModifyEnvironment()`. This function has sanity checks to + # verify we don't use `t.Parallel()` when setting envvars by using the + # `t.Setenv()` helper. + - ^os.Setenv$ + - ^os.Unsetenv$ stylecheck: # ST1000 checks for missing package comments. We don't use these for most # packages, so let's disable this check. |