diff --git a/.golangci.next.reference.yml b/.golangci.next.reference.yml index 3e7ac7eaca0d..66699d365084 100644 --- a/.golangci.next.reference.yml +++ b/.golangci.next.reference.yml @@ -3689,13 +3689,13 @@ linters: # Enable/disable `context.Background()` detections. # Disabled if Go < 1.24. - # Default: true - context-background: false + # Default: false + context-background: true # Enable/disable `context.TODO()` detections. # Disabled if Go < 1.24. - # Default: true - context-todo: false + # Default: false + context-todo: true unconvert: # Remove conversions that force intermediate rounding. diff --git a/go.mod b/go.mod index 72dd9208d831..4f7392bcb7ab 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( github.com/ldez/gomoddirectives v0.7.0 github.com/ldez/grignotin v0.9.0 github.com/ldez/tagliatelle v0.7.1 - github.com/ldez/usetesting v0.4.3 + github.com/ldez/usetesting v0.5.0 github.com/leonklingele/grouper v1.1.2 github.com/macabu/inamedparam v0.2.0 github.com/manuelarte/embeddedstructfieldcheck v0.3.0 diff --git a/go.sum b/go.sum index 8cde5e69bf0e..e46946e73357 100644 --- a/go.sum +++ b/go.sum @@ -381,8 +381,8 @@ github.com/ldez/grignotin v0.9.0 h1:MgOEmjZIVNn6p5wPaGp/0OKWyvq42KnzAt/DAb8O4Ow= github.com/ldez/grignotin v0.9.0/go.mod h1:uaVTr0SoZ1KBii33c47O1M8Jp3OP3YDwhZCmzT9GHEk= github.com/ldez/tagliatelle v0.7.1 h1:bTgKjjc2sQcsgPiT902+aadvMjCeMHrY7ly2XKFORIk= github.com/ldez/tagliatelle v0.7.1/go.mod h1:3zjxUpsNB2aEZScWiZTHrAXOl1x25t3cRmzfK1mlo2I= -github.com/ldez/usetesting v0.4.3 h1:pJpN0x3fMupdTf/IapYjnkhiY1nSTN+pox1/GyBRw3k= -github.com/ldez/usetesting v0.4.3/go.mod h1:eEs46T3PpQ+9RgN9VjpY6qWdiw2/QmfiDeWmdZdrjIQ= +github.com/ldez/usetesting v0.5.0 h1:3/QtzZObBKLy1F4F8jLuKJiKBjjVFi1IavpoWbmqLwc= +github.com/ldez/usetesting v0.5.0/go.mod h1:Spnb4Qppf8JTuRgblLrEWb7IE6rDmUpGvxY3iRrzvDQ= github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= github.com/leonklingele/grouper v1.1.2/go.mod h1:6D0M/HVkhs2yRKRFZUoGjeDy7EZTfFBE9gl4kjmIGkA= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json index 7e9db6cf8342..31e7fc2ffa7a 100644 --- a/jsonschema/golangci.next.jsonschema.json +++ b/jsonschema/golangci.next.jsonschema.json @@ -3775,11 +3775,11 @@ "properties": { "context-background": { "type": "boolean", - "default": true + "default": false }, "context-todo": { "type": "boolean", - "default": true + "default": false }, "os-chdir": { "type": "boolean", diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index e2838d808acb..7b3b6a12954a 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -172,8 +172,8 @@ var defaultLintersSettings = LintersSettings{ HTTPStatusCode: true, }, UseTesting: UseTestingSettings{ - ContextBackground: true, - ContextTodo: true, + ContextBackground: false, + ContextTodo: false, OSChdir: true, OSMkdirTemp: true, OSSetenv: true, diff --git a/pkg/golinters/usetesting/testdata/usetesting_go124.go b/pkg/golinters/usetesting/testdata/usetesting_go124.go index aae2c6ebe810..614c87daaf00 100644 --- a/pkg/golinters/usetesting/testdata/usetesting_go124.go +++ b/pkg/golinters/usetesting/testdata/usetesting_go124.go @@ -10,11 +10,11 @@ import ( ) func Test_contextBackground(t *testing.T) { - context.Background() // want `context\.Background\(\) could be replaced by t\.Context\(\) in .+` + context.Background() } func Test_contextTODO(t *testing.T) { - context.TODO() // want `context\.TODO\(\) could be replaced by t\.Context\(\) in .+` + context.TODO() } func Test_osChdir(t *testing.T) { diff --git a/pkg/golinters/usetesting/testdata/usetesting_go124_configuration.go b/pkg/golinters/usetesting/testdata/usetesting_go124_configuration.go index 44774f3cb399..2a1159538dc4 100644 --- a/pkg/golinters/usetesting/testdata/usetesting_go124_configuration.go +++ b/pkg/golinters/usetesting/testdata/usetesting_go124_configuration.go @@ -11,11 +11,11 @@ import ( ) func Test_contextBackground(t *testing.T) { - context.Background() + context.Background() // want `context\.Background\(\) could be replaced by t\.Context\(\) in .+` } func Test_contextTODO(t *testing.T) { - context.TODO() + context.TODO() // want `context\.TODO\(\) could be replaced by t\.Context\(\) in .+` } func Test_osChdir(t *testing.T) { diff --git a/pkg/golinters/usetesting/testdata/usetesting_go124_configuration.yml b/pkg/golinters/usetesting/testdata/usetesting_go124_configuration.yml index e848078d1097..b62936018fc5 100644 --- a/pkg/golinters/usetesting/testdata/usetesting_go124_configuration.yml +++ b/pkg/golinters/usetesting/testdata/usetesting_go124_configuration.yml @@ -8,5 +8,5 @@ linters: os-setenv: true os-temp-dir: true os-chdir: false - context-background: false - context-todo: false + context-background: true + context-todo: true