Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion _examples/cloudfunction/function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion _examples/extension/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion _examples/instrumentation/expvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions _examples/logging/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion _examples/logging/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions _examples/security/tls_configure_ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build ignore
// +build ignore

package main
Expand Down
1 change: 1 addition & 0 deletions _examples/security/tls_with_ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build ignore
// +build ignore

package main
Expand Down
2 changes: 1 addition & 1 deletion _examples/xkcdsearch/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions elasticsearch_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package elasticsearch_test
Expand Down
1 change: 1 addition & 0 deletions elasticsearch_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package elasticsearch_test
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build integration && !multinode
// +build integration,!multinode

package elasticsearch_test
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions esapi/esapi_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions esapi/esapi_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build integration
// +build integration

package esapi_test
Expand Down
1 change: 1 addition & 0 deletions esapi/esapi_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package esapi
Expand Down
1 change: 1 addition & 0 deletions esapi/esapi_response_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package esapi
Expand Down
1 change: 1 addition & 0 deletions esutil/bulk_indexer_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package esutil_test
Expand Down
1 change: 1 addition & 0 deletions esutil/bulk_indexer_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package esutil_test
Expand Down
2 changes: 1 addition & 1 deletion esutil/bulk_indexer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
19 changes: 10 additions & 9 deletions esutil/bulk_indexer_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package esutil
Expand Down Expand Up @@ -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
},
Expand Down Expand Up @@ -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
},
Expand Down Expand Up @@ -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
},
}})
Expand Down Expand Up @@ -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
},
},
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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",
},
Expand Down Expand Up @@ -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"},
},
},
Expand Down
1 change: 1 addition & 0 deletions esutil/json_reader_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package esutil_test
Expand Down
1 change: 1 addition & 0 deletions esutil/json_reader_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build integration
// +build integration

package esutil_test
Expand Down
1 change: 1 addition & 0 deletions esutil/json_reader_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build !integration
// +build !integration

package esutil
Expand Down
4 changes: 2 additions & 2 deletions internal/build/cmd/generate/commands/gensource/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -543,4 +543,4 @@ func (u *URL) ContainsMethods(methods ...string) bool {
continue
}
return true
}
}
4 changes: 2 additions & 2 deletions internal/build/cmd/generate/commands/genstruct/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -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))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//go:build ignore
// +build ignore

package main
Expand Down
2 changes: 1 addition & 1 deletion internal/build/cmd/tools/commands/spec/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Expand Down
8 changes: 4 additions & 4 deletions internal/build/cmd/tools/commands/spec/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -63,4 +63,4 @@ func TestBuild_zipfileUrl(t *testing.T) {
}
})
}
}
}