diff --git a/.golangci.yml b/.golangci.yml index 7c421f0be6..b8391990ac 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,6 +10,7 @@ linters: - nakedret - testifylint - thelper + - usestdlibvars linters-settings: nakedret: diff --git a/modules/elasticsearch/elasticsearch_test.go b/modules/elasticsearch/elasticsearch_test.go index fdfe636769..99829e94d3 100644 --- a/modules/elasticsearch/elasticsearch_test.go +++ b/modules/elasticsearch/elasticsearch_test.go @@ -87,7 +87,7 @@ func TestElasticsearch(t *testing.T) { httpClient := configureHTTPClient(esContainer) - req, err := http.NewRequest("GET", esContainer.Settings.Address, nil) + req, err := http.NewRequest(http.MethodGet, esContainer.Settings.Address, nil) require.NoError(t, err) // set the password for the request using the Authentication header @@ -201,7 +201,7 @@ func TestElasticsearch8WithoutCredentials(t *testing.T) { httpClient := configureHTTPClient(ctr) - req, err := http.NewRequest("GET", ctr.Settings.Address, nil) + req, err := http.NewRequest(http.MethodGet, ctr.Settings.Address, nil) require.NoError(t, err) // elastic:changeme are the default credentials for Elasticsearch 8 diff --git a/modules/ollama/examples_test.go b/modules/ollama/examples_test.go index 46d65ebe0a..e9ac3ce0fa 100644 --- a/modules/ollama/examples_test.go +++ b/modules/ollama/examples_test.go @@ -85,7 +85,7 @@ func ExampleRun_withModel_llama2_http() { "prompt":"Why is the sky blue?" }` - req, err := http.NewRequest("POST", fmt.Sprintf("%s/api/generate", connectionStr), strings.NewReader(payload)) + req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("%s/api/generate", connectionStr), strings.NewReader(payload)) if err != nil { log.Printf("failed to create request: %s", err) return diff --git a/modules/opensearch/opensearch_test.go b/modules/opensearch/opensearch_test.go index 3829ea2dfb..15304dbfd6 100644 --- a/modules/opensearch/opensearch_test.go +++ b/modules/opensearch/opensearch_test.go @@ -24,7 +24,7 @@ func TestOpenSearch(t *testing.T) { client := &http.Client{} - req, err := http.NewRequest("GET", address, nil) + req, err := http.NewRequest(http.MethodGet, address, nil) require.NoError(t, err) resp, err := client.Do(req)