diff --git a/pkg/messages/message.go b/pkg/messages/message.go index 28613e7..5d8d51a 100644 --- a/pkg/messages/message.go +++ b/pkg/messages/message.go @@ -32,7 +32,7 @@ func (m Message) Ack() (Ack, error) { }, nil } -func (m Message) setAsAcked() error { +func (m *Message) setAsAcked() error { if m.acked { return errors.New("Message already acked") } diff --git a/pkg/writers/adapters/elasticsearch_test.go b/pkg/writers/adapters/elasticsearch_test.go index c5d423f..4afe95d 100644 --- a/pkg/writers/adapters/elasticsearch_test.go +++ b/pkg/writers/adapters/elasticsearch_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "io" - "os" "strings" "testing" ) @@ -98,7 +97,7 @@ func TestBulkActionWithSingleItemSucessful(t *testing.T) { response := esapi.Response{ StatusCode: 201, Header: nil, - Body: os.NopCloser(strings.NewReader("{\"errors\":false,\"items\":[{\"create\":{\"status\":200}}]}")), + Body: io.NopCloser(strings.NewReader("{\"errors\":false,\"items\":[{\"create\":{\"status\":200}}]}")), } bulk.On("func1", mock.Anything).Once().Return(&response, nil) @@ -125,7 +124,7 @@ func TestBulkActionWithSingleItemUnsuccessful(t *testing.T) { response := esapi.Response{ StatusCode: 201, Header: nil, - Body: os.NopCloser(strings.NewReader("{\"errors\":true,\"items\":[{\"create\":{\"status\":409}}]}")), + Body: io.NopCloser(strings.NewReader("{\"errors\":true,\"items\":[{\"create\":{\"status\":409}}]}")), } bulk.On("func1", mock.Anything).Once().Return(&response, nil) @@ -152,7 +151,7 @@ func TestBulkActionWithMixedItemStatus(t *testing.T) { response := esapi.Response{ StatusCode: 201, Header: nil, - Body: os.NopCloser(strings.NewReader("{\"errors\":true,\"items\":[{\"create\":{\"status\":409}},{\"create\":{\"status\":200}},{\"create\":{\"status\":409}}]}")), + Body: io.NopCloser(strings.NewReader("{\"errors\":true,\"items\":[{\"create\":{\"status\":409}},{\"create\":{\"status\":200}},{\"create\":{\"status\":409}}]}")), } bulk.On("func1", mock.Anything).Once().Return(&response, nil) @@ -189,7 +188,7 @@ func TestBulkActionWithOnlyMetadata(t *testing.T) { response := esapi.Response{ StatusCode: 201, Header: nil, - Body: os.NopCloser(strings.NewReader("{\"errors\":false,\"items\":[{\"delete\":{\"status\":200}}]}")), + Body: io.NopCloser(strings.NewReader("{\"errors\":false,\"items\":[{\"delete\":{\"status\":200}}]}")), } expectedBody := "{\"delete\":{\"_id\":\"123\"}}\n" bulk.On("func1", expectedBody).Once().Return(&response, nil)