diff --git a/_examples/cloudfunction/function_test.go b/_examples/cloudfunction/function_test.go index 6a4493ec14..3ce7dd63e3 100644 --- a/_examples/cloudfunction/function_test.go +++ b/_examples/cloudfunction/function_test.go @@ -36,7 +36,7 @@ type MockTransport struct{} // RoundTrip returns a mock response. func (t *MockTransport) RoundTrip(req *http.Request) (*http.Response, error) { return &http.Response{ - Body: ioutil.NopCloser(strings.NewReader(`{"status":"mocked"}`)), + Body: ioutil.NopCloser(strings.NewReader(`{"status":"mocked"}`)), Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, }, nil } diff --git a/_examples/extension/main.go b/_examples/extension/main.go index 47e68e58f7..a49c804050 100644 --- a/_examples/extension/main.go +++ b/_examples/extension/main.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build ignore // +build ignore // This examples demonstrates how extend the API of the client by embedding it inside a custom type. @@ -30,9 +31,9 @@ import ( "net/url" "os" + "github.com/elastic/elastic-transport-go/v8/elastictransport" "github.com/elastic/go-elasticsearch/v8" "github.com/elastic/go-elasticsearch/v8/esapi" - "github.com/elastic/elastic-transport-go/v8/elastictransport" ) const port = "9209" diff --git a/_examples/instrumentation/expvar.go b/_examples/instrumentation/expvar.go index f8d39b8778..f0913ff37e 100644 --- a/_examples/instrumentation/expvar.go +++ b/_examples/instrumentation/expvar.go @@ -36,8 +36,8 @@ import ( "golang.org/x/crypto/ssh/terminal" - "github.com/elastic/go-elasticsearch/v8" "github.com/elastic/elastic-transport-go/v8/elastictransport" + "github.com/elastic/go-elasticsearch/v8" ) var ( diff --git a/_examples/logging/custom.go b/_examples/logging/custom.go index c95e66697f..a6f09051f9 100644 --- a/_examples/logging/custom.go +++ b/_examples/logging/custom.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build ignore // +build ignore // This examples demonstrates how to implement the "elastictransport.Logger" interface with a custom type, diff --git a/_examples/logging/default.go b/_examples/logging/default.go index 64b1e0cb2c..4d902f17cf 100644 --- a/_examples/logging/default.go +++ b/_examples/logging/default.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build ignore // +build ignore // This collection of examples demonstrates how to configure the default logger of the client. @@ -31,8 +32,8 @@ import ( "os" "strings" - "github.com/elastic/go-elasticsearch/v8" "github.com/elastic/elastic-transport-go/v8/elastictransport" + "github.com/elastic/go-elasticsearch/v8" ) func main() { diff --git a/_examples/security/tls_configure_ca.go b/_examples/security/tls_configure_ca.go index 109259fd73..c24f7b3760 100644 --- a/_examples/security/tls_configure_ca.go +++ b/_examples/security/tls_configure_ca.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build ignore // +build ignore package main diff --git a/_examples/security/tls_with_ca.go b/_examples/security/tls_with_ca.go index 39dc6e1d06..db88813d3f 100644 --- a/_examples/security/tls_with_ca.go +++ b/_examples/security/tls_with_ca.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build ignore // +build ignore package main diff --git a/_examples/xkcdsearch/store_test.go b/_examples/xkcdsearch/store_test.go index df4a260bc0..fdda0d3912 100644 --- a/_examples/xkcdsearch/store_test.go +++ b/_examples/xkcdsearch/store_test.go @@ -81,7 +81,7 @@ func TestStore(t *testing.T) { Response: &http.Response{ StatusCode: http.StatusOK, Body: ioutil.NopCloser(strings.NewReader(`{}`)), - Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, + Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, }, } mocktrans.RoundTripFn = func(req *http.Request) (*http.Response, error) { return mocktrans.Response, nil } diff --git a/elasticsearch_benchmark_test.go b/elasticsearch_benchmark_test.go index 1fc69477ea..606d36561d 100644 --- a/elasticsearch_benchmark_test.go +++ b/elasticsearch_benchmark_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package elasticsearch_test diff --git a/elasticsearch_example_test.go b/elasticsearch_example_test.go index d904a2db09..896a051976 100644 --- a/elasticsearch_example_test.go +++ b/elasticsearch_example_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package elasticsearch_test diff --git a/elasticsearch_integration_test.go b/elasticsearch_integration_test.go index 416f2444e9..dbf69e9b70 100644 --- a/elasticsearch_integration_test.go +++ b/elasticsearch_integration_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build integration && !multinode // +build integration,!multinode package elasticsearch_test @@ -33,9 +34,9 @@ import ( "testing" "time" + "github.com/elastic/elastic-transport-go/v8/elastictransport" "github.com/elastic/go-elasticsearch/v8" "github.com/elastic/go-elasticsearch/v8/esapi" - "github.com/elastic/elastic-transport-go/v8/elastictransport" ) func TestClientTransport(t *testing.T) { diff --git a/esapi/esapi_benchmark_test.go b/esapi/esapi_benchmark_test.go index 5ffd03889b..3024b0c877 100644 --- a/esapi/esapi_benchmark_test.go +++ b/esapi/esapi_benchmark_test.go @@ -32,10 +32,10 @@ import ( // TODO(karmi): Refactor into a shared mock/testing package var ( - defaultResponse = &http.Response{ + defaultResponse = &http.Response{ StatusCode: 200, - Body: ioutil.NopCloser(strings.NewReader("MOCK")), - Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, + Body: ioutil.NopCloser(strings.NewReader("MOCK")), + Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, } defaultRoundTripFn = func(*http.Request) (*http.Response, error) { return defaultResponse, nil } errorRoundTripFn = func(*http.Request) (*http.Response, error) { diff --git a/esapi/esapi_integration_test.go b/esapi/esapi_integration_test.go index c993a270db..58cbebc105 100644 --- a/esapi/esapi_integration_test.go +++ b/esapi/esapi_integration_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build integration // +build integration package esapi_test diff --git a/esapi/esapi_internal_test.go b/esapi/esapi_internal_test.go index 4e2f92380b..3f4ba0f2ee 100644 --- a/esapi/esapi_internal_test.go +++ b/esapi/esapi_internal_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package esapi diff --git a/esapi/esapi_response_internal_test.go b/esapi/esapi_response_internal_test.go index baafcb0133..16193035a7 100644 --- a/esapi/esapi_response_internal_test.go +++ b/esapi/esapi_response_internal_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package esapi diff --git a/esutil/bulk_indexer_benchmark_test.go b/esutil/bulk_indexer_benchmark_test.go index af58e0f398..8ec356cedf 100644 --- a/esutil/bulk_indexer_benchmark_test.go +++ b/esutil/bulk_indexer_benchmark_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package esutil_test diff --git a/esutil/bulk_indexer_example_test.go b/esutil/bulk_indexer_example_test.go index 4cd76f2970..31e6209240 100644 --- a/esutil/bulk_indexer_example_test.go +++ b/esutil/bulk_indexer_example_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package esutil_test diff --git a/esutil/bulk_indexer_integration_test.go b/esutil/bulk_indexer_integration_test.go index 300169dcbc..da64706834 100644 --- a/esutil/bulk_indexer_integration_test.go +++ b/esutil/bulk_indexer_integration_test.go @@ -30,8 +30,8 @@ import ( "testing" "time" - "github.com/elastic/go-elasticsearch/v8" "github.com/elastic/elastic-transport-go/v8/elastictransport" + "github.com/elastic/go-elasticsearch/v8" "github.com/elastic/go-elasticsearch/v8/esutil" ) diff --git a/esutil/bulk_indexer_internal_test.go b/esutil/bulk_indexer_internal_test.go index 9d5b0edb2e..43dbcdc983 100644 --- a/esutil/bulk_indexer_internal_test.go +++ b/esutil/bulk_indexer_internal_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package esutil @@ -80,7 +81,7 @@ func TestBulkIndexer(t *testing.T) { } bodyContent, _ := ioutil.ReadFile(testfile) return &http.Response{ - Body: ioutil.NopCloser(bytes.NewBuffer(bodyContent)), + Body: ioutil.NopCloser(bytes.NewBuffer(bodyContent)), Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, }, nil }, @@ -264,7 +265,7 @@ func TestBulkIndexer(t *testing.T) { es, _ := elasticsearch.NewClient(elasticsearch.Config{Transport: &mockTransport{ RoundTripFunc: func(*http.Request) (*http.Response, error) { return &http.Response{ - Body: ioutil.NopCloser(bytes.NewBuffer(bodyContent)), + Body: ioutil.NopCloser(bytes.NewBuffer(bodyContent)), Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, }, nil }, @@ -434,7 +435,7 @@ func TestBulkIndexer(t *testing.T) { StatusCode: http.StatusOK, Status: "200 OK", Body: ioutil.NopCloser(strings.NewReader(`{"items":[{"index": {}}]}`)), - Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, + Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, }, nil }, }}) @@ -504,7 +505,7 @@ func TestBulkIndexer(t *testing.T) { StatusCode: http.StatusOK, Status: "200 OK", Body: ioutil.NopCloser(bytes.NewBuffer(bodyContent)), - Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, + Header: http.Header{"X-Elastic-Product": []string{"Elasticsearch"}}, }, nil }, }, @@ -594,7 +595,7 @@ func TestBulkIndexer(t *testing.T) { } }) t.Run("Worker.writeMeta()", func(t *testing.T) { - v:=int64(23) + v := int64(23) type args struct { item BulkIndexerItem } @@ -636,9 +637,9 @@ func TestBulkIndexer(t *testing.T) { { "with version and no document", args{BulkIndexerItem{ - Action: "index", - Index: "test", - Version: &v, + Action: "index", + Index: "test", + Version: &v, }}, `{"index":{"_index":"test"}}` + "\n", }, @@ -722,7 +723,7 @@ func TestBulkIndexer(t *testing.T) { args: args{ disableMetaHeader: false, header: http.Header{ - "X-Test-User": []string{"UserValue"}, + "X-Test-User": []string{"UserValue"}, elasticsearch.HeaderClientMeta: []string{"h=shouldntbechanged"}, }, }, diff --git a/esutil/json_reader_benchmark_test.go b/esutil/json_reader_benchmark_test.go index 3c0ed98844..f9caa9e927 100644 --- a/esutil/json_reader_benchmark_test.go +++ b/esutil/json_reader_benchmark_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package esutil_test diff --git a/esutil/json_reader_integration_test.go b/esutil/json_reader_integration_test.go index c397c247e9..26547d232c 100644 --- a/esutil/json_reader_integration_test.go +++ b/esutil/json_reader_integration_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build integration // +build integration package esutil_test diff --git a/esutil/json_reader_internal_test.go b/esutil/json_reader_internal_test.go index 642159c643..6b3841f0c5 100644 --- a/esutil/json_reader_internal_test.go +++ b/esutil/json_reader_internal_test.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build !integration // +build !integration package esutil diff --git a/internal/build/cmd/generate/commands/gensource/model.go b/internal/build/cmd/generate/commands/gensource/model.go index 3e3fae08a1..38e25f75c7 100644 --- a/internal/build/cmd/generate/commands/gensource/model.go +++ b/internal/build/cmd/generate/commands/gensource/model.go @@ -396,7 +396,7 @@ func (e *Endpoint) RequiredArguments() []MethodArgument { } var keys []string - for k := range e.URL.Paths[0].Parts{ + for k := range e.URL.Paths[0].Parts { keys = append(keys, k) } sort.Strings(keys) @@ -543,4 +543,4 @@ func (u *URL) ContainsMethods(methods ...string) bool { continue } return true -} \ No newline at end of file +} diff --git a/internal/build/cmd/generate/commands/genstruct/command.go b/internal/build/cmd/generate/commands/genstruct/command.go index bc88bc97aa..15aeba43c1 100644 --- a/internal/build/cmd/generate/commands/genstruct/command.go +++ b/internal/build/cmd/generate/commands/genstruct/command.go @@ -272,7 +272,7 @@ type API struct { // Some methods are equal to the namespace (like 'rollup.rollup') // and we don't want to have an empty string here. if len(methodName) == 0 { - methodName = strings.Replace(name, n, "", 1) + methodName = strings.Replace(name, n, "", 1) } b.WriteString(fmt.Sprintf("\t%s %s\n", methodName, name)) } @@ -309,7 +309,7 @@ func New(t Transport) *API { // Some methods are equal to the namespace (like 'rollup.rollup') // and we don't want to have an empty string here. if len(methodName) == 0 { - methodName = strings.Replace(name, n, "", 1) + methodName = strings.Replace(name, n, "", 1) } b.WriteString(fmt.Sprintf("\t\t\t%s: new%sFunc(t),\n", methodName, name)) } diff --git a/internal/build/cmd/generate/commands/gentests/gen_api_registry.go b/internal/build/cmd/generate/commands/gentests/gen_api_registry.go index 2573407ed3..e71d457fc6 100644 --- a/internal/build/cmd/generate/commands/gentests/gen_api_registry.go +++ b/internal/build/cmd/generate/commands/gentests/gen_api_registry.go @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +//go:build ignore // +build ignore package main diff --git a/internal/build/cmd/tools/commands/spec/command.go b/internal/build/cmd/tools/commands/spec/command.go index a0d6a59207..38934a81d0 100644 --- a/internal/build/cmd/tools/commands/spec/command.go +++ b/internal/build/cmd/tools/commands/spec/command.go @@ -200,7 +200,7 @@ type Build struct { } func NewBuild() Build { - t := time.Date(1970, 0,0,0,0,0,0, time.UTC) + t := time.Date(1970, 0, 0, 0, 0, 0, 0, time.UTC) startTime := BuildStartTime{Time: &t} return Build{StartTime: startTime} } diff --git a/internal/build/cmd/tools/commands/spec/command_test.go b/internal/build/cmd/tools/commands/spec/command_test.go index 79a480be75..c4c5e66637 100644 --- a/internal/build/cmd/tools/commands/spec/command_test.go +++ b/internal/build/cmd/tools/commands/spec/command_test.go @@ -24,9 +24,9 @@ import ( func TestBuild_zipfileUrl(t *testing.T) { tests := []struct { - name string - json string - want string + name string + json string + want string }{ { name: "Simple test with valid url", @@ -63,4 +63,4 @@ func TestBuild_zipfileUrl(t *testing.T) { } }) } -} \ No newline at end of file +}