From f9779b24ada80a8a9fc264f0ae60b3cb1b3498f4 Mon Sep 17 00:00:00 2001 From: Pontus Leitzler Date: Wed, 14 Nov 2018 19:23:44 +0100 Subject: [PATCH] Enable default vet flags (#6810) Enable default vet flags except experimental --- Makefile | 4 +- cmd/admin-handlers_test.go | 2 +- cmd/encryption-v1_test.go | 6 +-- cmd/endpoint-ellipses_test.go | 90 +++++++++++++++---------------- cmd/gateway/s3/gateway-s3.go | 2 +- cmd/notification.go | 4 +- cmd/object-api-multipart_test.go | 10 ++-- cmd/object-api-putobject_test.go | 16 +++--- cmd/peer-rpc-client-target.go | 2 +- pkg/event/target/amqp.go | 4 +- pkg/event/target/elasticsearch.go | 2 +- pkg/event/target/httpclient.go | 2 +- pkg/event/target/kafka.go | 4 +- pkg/event/target/mqtt.go | 4 +- pkg/event/target/mysql.go | 2 +- pkg/event/target/nats.go | 4 +- pkg/event/target/nsq.go | 4 +- pkg/event/target/postgresql.go | 2 +- pkg/event/target/redis.go | 2 +- pkg/event/target/webhook.go | 4 +- 20 files changed, 85 insertions(+), 85 deletions(-) diff --git a/Makefile b/Makefile index 1d0048ef5..be86ed41b 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,8 @@ verifiers: getdeps vet fmt lint cyclo deadcode spelling vet: @echo "Running $@" - @go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult cmd - @go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult pkg + @go tool vet cmd + @go tool vet pkg fmt: @echo "Running $@" diff --git a/cmd/admin-handlers_test.go b/cmd/admin-handlers_test.go index 6dcea33cf..84619e988 100644 --- a/cmd/admin-handlers_test.go +++ b/cmd/admin-handlers_test.go @@ -550,7 +550,7 @@ func testServicesCmdHandler(cmd cmdType, t *testing.T) { credentials := globalServerConfig.GetCredential() body, err := json.Marshal(madmin.ServiceAction{ - cmd.toServiceActionValue()}) + Action: cmd.toServiceActionValue()}) if err != nil { t.Fatalf("JSONify error: %v", err) } diff --git a/cmd/encryption-v1_test.go b/cmd/encryption-v1_test.go index 9cd4221d7..7d12b271d 100644 --- a/cmd/encryption-v1_test.go +++ b/cmd/encryption-v1_test.go @@ -37,7 +37,7 @@ var hasServerSideEncryptionHeaderTests = []struct { {headers: map[string]string{}, sseRequest: false}, // 4 {headers: map[string]string{crypto.SSECopyAlgorithm + " ": "AES256", " " + crypto.SSECopyKey: "key", crypto.SSECopyKeyMD5 + " ": "md5"}, sseRequest: false}, // 5 {headers: map[string]string{crypto.SSECopyAlgorithm: "", crypto.SSECopyKey: "", crypto.SSECopyKeyMD5: ""}, sseRequest: false}, // 6 - {headers: map[string]string{crypto.SSEHeader: ""}, sseRequest: true}, // 6 + {headers: map[string]string{crypto.SSEHeader: ""}, sseRequest: true}, // 7 } func TestHasServerSideEncryptionHeader(t *testing.T) { @@ -89,12 +89,12 @@ var hasSSECustomerHeaderTests = []struct { {headers: map[string]string{crypto.SSECKeyMD5: "md5"}, sseRequest: true}, // 3 {headers: map[string]string{}, sseRequest: false}, // 4 {headers: map[string]string{crypto.SSECAlgorithm + " ": "AES256", " " + crypto.SSECKey: "key", crypto.SSECKeyMD5 + " ": "md5"}, sseRequest: false}, // 5 - {headers: map[string]string{crypto.SSECAlgorithm: "", crypto.SSECKey: "", crypto.SSECKeyMD5: ""}, sseRequest: false}, // 6 + {headers: map[string]string{crypto.SSECAlgorithm: "", crypto.SSECKey: "", crypto.SSECKeyMD5: ""}, sseRequest: true}, // 6 {headers: map[string]string{crypto.SSEHeader: ""}, sseRequest: false}, // 7 } -func TesthasSSECustomerHeader(t *testing.T) { +func TestHasSSECustomerHeader(t *testing.T) { for i, test := range hasSSECustomerHeaderTests { headers := http.Header{} for k, v := range test.headers { diff --git a/cmd/endpoint-ellipses_test.go b/cmd/endpoint-ellipses_test.go index 4379708ce..b5dacc852 100644 --- a/cmd/endpoint-ellipses_test.go +++ b/cmd/endpoint-ellipses_test.go @@ -287,9 +287,9 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "/export/set", - "", - getSequences(1, 64, 0), + Prefix: "/export/set", + Suffix: "", + Seq: getSequences(1, 64, 0), }, }, }, @@ -305,14 +305,14 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "", - "", - getSequences(1, 64, 0), + Prefix: "", + Suffix: "", + Seq: getSequences(1, 64, 0), }, { - "http://minio", - "/export/set", - getSequences(2, 3, 0), + Prefix: "http://minio", + Suffix: "/export/set", + Seq: getSequences(2, 3, 0), }, }, }, @@ -328,9 +328,9 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "http://minio", - ".mydomain.net/data", - getSequences(1, 64, 0), + Prefix: "http://minio", + Suffix: ".mydomain.net/data", + Seq: getSequences(1, 64, 0), }, }, }, @@ -345,14 +345,14 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "", - "/data", - getSequences(1, 16, 0), + Prefix: "", + Suffix: "/data", + Seq: getSequences(1, 16, 0), }, { - "http://rack", - ".mydomain.minio", - getSequences(1, 4, 0), + Prefix: "http://rack", + Suffix: ".mydomain.minio", + Seq: getSequences(1, 4, 0), }, }, }, @@ -368,14 +368,14 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "", - "", - getSequences(0, 1, 0), + Prefix: "", + Suffix: "", + Seq: getSequences(0, 1, 0), }, { - "http://minio", - ".mydomain.net/data", - getSequences(0, 15, 0), + Prefix: "http://minio", + Suffix: ".mydomain.net/data", + Seq: getSequences(0, 15, 0), }, }, }, @@ -391,9 +391,9 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "http://server1/data", - "", - getSequences(1, 32, 0), + Prefix: "http://server1/data", + Suffix: "", + Seq: getSequences(1, 32, 0), }, }, }, @@ -409,9 +409,9 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "http://server1/data", - "", - getSequences(1, 32, 2), + Prefix: "http://server1/data", + Suffix: "", + Seq: getSequences(1, 32, 2), }, }, }, @@ -427,19 +427,19 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "", - "", - getSequences(1, 2, 0), + Prefix: "", + Suffix: "", + Seq: getSequences(1, 2, 0), }, { - "", - "/test", - getSequences(1, 64, 0), + Prefix: "", + Suffix: "/test", + Seq: getSequences(1, 64, 0), }, { - "http://minio", - "/export/set", - getSequences(2, 3, 0), + Prefix: "http://minio", + Suffix: "/export/set", + Seq: getSequences(2, 3, 0), }, }, }, @@ -456,14 +456,14 @@ func TestParseEndpointSet(t *testing.T) { []ellipses.ArgPattern{ []ellipses.Pattern{ { - "", - "", - getSequences(1, 10, 0), + Prefix: "", + Suffix: "", + Seq: getSequences(1, 10, 0), }, { - "/export", - "/disk", - getSequences(1, 10, 0), + Prefix: "/export", + Suffix: "/disk", + Seq: getSequences(1, 10, 0), }, }, }, diff --git a/cmd/gateway/s3/gateway-s3.go b/cmd/gateway/s3/gateway-s3.go index 78381f301..72036ea38 100644 --- a/cmd/gateway/s3/gateway-s3.go +++ b/cmd/gateway/s3/gateway-s3.go @@ -397,7 +397,7 @@ func (l *s3Objects) GetObject(ctx context.Context, bucket string, key string, st // GetObjectInfo reads object info and replies back ObjectInfo func (l *s3Objects) GetObjectInfo(ctx context.Context, bucket string, object string, opts minio.ObjectOptions) (objInfo minio.ObjectInfo, err error) { - oi, err := l.Client.StatObject(bucket, object, miniogo.StatObjectOptions{miniogo.GetObjectOptions{ServerSideEncryption: opts.ServerSideEncryption}}) + oi, err := l.Client.StatObject(bucket, object, miniogo.StatObjectOptions{GetObjectOptions: miniogo.GetObjectOptions{ServerSideEncryption: opts.ServerSideEncryption}}) if err != nil { return minio.ObjectInfo{}, minio.ErrorRespToObjectError(err, bucket, object) } diff --git a/cmd/notification.go b/cmd/notification.go index a913d79c1..b03a919e1 100644 --- a/cmd/notification.go +++ b/cmd/notification.go @@ -510,7 +510,7 @@ func (args eventArgs) ToEvent() event.Event { AwsRegion: args.ReqParams["region"], EventTime: eventTime.Format(event.AMZTimeFormat), EventName: args.EventName, - UserIdentity: event.Identity{args.ReqParams["accessKey"]}, + UserIdentity: event.Identity{PrincipalID: args.ReqParams["accessKey"]}, RequestParameters: args.ReqParams, ResponseElements: respElements, S3: event.Metadata{ @@ -518,7 +518,7 @@ func (args eventArgs) ToEvent() event.Event { ConfigurationID: "Config", Bucket: event.Bucket{ Name: args.BucketName, - OwnerIdentity: event.Identity{args.ReqParams["accessKey"]}, + OwnerIdentity: event.Identity{PrincipalID: args.ReqParams["accessKey"]}, ARN: policy.ResourceARNPrefix + args.BucketName, }, Object: event.Object{ diff --git a/cmd/object-api-multipart_test.go b/cmd/object-api-multipart_test.go index 6cd2171cc..7f8a73da0 100644 --- a/cmd/object-api-multipart_test.go +++ b/cmd/object-api-multipart_test.go @@ -329,20 +329,20 @@ func testObjectAPIPutObjectPart(obj ObjectLayer, instanceType string, t TestErrH // Test case - 12. // Input to replicate Md5 mismatch. {bucket, object, uploadID, 1, "", "d41d8cd98f00b204e9800998ecf8427f", "", 0, false, "", - hash.BadDigest{"d41d8cd98f00b204e9800998ecf8427f", "d41d8cd98f00b204e9800998ecf8427e"}}, + hash.BadDigest{ExpectedMD5: "d41d8cd98f00b204e9800998ecf8427f", CalculatedMD5: "d41d8cd98f00b204e9800998ecf8427e"}}, // Test case - 13. // When incorrect sha256 is provided. {bucket, object, uploadID, 1, "", "", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b854", 0, false, "", - hash.SHA256Mismatch{"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b854", - "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}}, + hash.SHA256Mismatch{ExpectedSHA256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b854", + CalculatedSHA256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}}, // Test case - 14. // Input with size more than the size of actual data inside the reader. {bucket, object, uploadID, 1, "abcd", "e2fc714c4727ee9395f324cd2e7f3335", "", int64(len("abcd") + 1), false, "", - hash.BadDigest{"e2fc714c4727ee9395f324cd2e7f3335", "e2fc714c4727ee9395f324cd2e7f331f"}}, + hash.BadDigest{ExpectedMD5: "e2fc714c4727ee9395f324cd2e7f3335", CalculatedMD5: "e2fc714c4727ee9395f324cd2e7f331f"}}, // Test case - 15. // Input with size less than the size of actual data inside the reader. {bucket, object, uploadID, 1, "abcd", "900150983cd24fb0d6963f7d28e17f73", "", int64(len("abcd") - 1), false, "", - hash.BadDigest{"900150983cd24fb0d6963f7d28e17f73", "900150983cd24fb0d6963f7d28e17f72"}}, + hash.BadDigest{ExpectedMD5: "900150983cd24fb0d6963f7d28e17f73", CalculatedMD5: "900150983cd24fb0d6963f7d28e17f72"}}, // Test case - 16-19. // Validating for success cases. diff --git a/cmd/object-api-putobject_test.go b/cmd/object-api-putobject_test.go index 37c7fe8d7..34df3ceca 100644 --- a/cmd/object-api-putobject_test.go +++ b/cmd/object-api-putobject_test.go @@ -97,24 +97,24 @@ func testObjectAPIPutObject(obj ObjectLayer, instanceType string, t TestErrHandl // Test case - 7. // Input to replicate Md5 mismatch. {bucket, object, []byte(""), map[string]string{"etag": "d41d8cd98f00b204e9800998ecf8427f"}, "", 0, "", - hash.BadDigest{"d41d8cd98f00b204e9800998ecf8427f", "d41d8cd98f00b204e9800998ecf8427e"}}, + hash.BadDigest{ExpectedMD5: "d41d8cd98f00b204e9800998ecf8427f", CalculatedMD5: "d41d8cd98f00b204e9800998ecf8427e"}}, // Test case - 8. // With incorrect sha256. {bucket, object, []byte("abcd"), map[string]string{"etag": "e2fc714c4727ee9395f324cd2e7f331f"}, "88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031580", int64(len("abcd")), - "", hash.SHA256Mismatch{"88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031580", - "88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031589"}}, + "", hash.SHA256Mismatch{ExpectedSHA256: "88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031580", + CalculatedSHA256: "88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031589"}}, // Test case - 9. // Input with size more than the size of actual data inside the reader. {bucket, object, []byte("abcd"), map[string]string{"etag": "e2fc714c4727ee9395f324cd2e7f331e"}, "", int64(len("abcd") + 1), "", - hash.BadDigest{"e2fc714c4727ee9395f324cd2e7f331e", "e2fc714c4727ee9395f324cd2e7f331f"}}, + hash.BadDigest{ExpectedMD5: "e2fc714c4727ee9395f324cd2e7f331e", CalculatedMD5: "e2fc714c4727ee9395f324cd2e7f331f"}}, // Test case - 10. // Input with size less than the size of actual data inside the reader. {bucket, object, []byte("abcd"), map[string]string{"etag": "900150983cd24fb0d6963f7d28e17f73"}, "", int64(len("abcd") - 1), "", - hash.BadDigest{"900150983cd24fb0d6963f7d28e17f73", "900150983cd24fb0d6963f7d28e17f72"}}, + hash.BadDigest{ExpectedMD5: "900150983cd24fb0d6963f7d28e17f73", CalculatedMD5: "900150983cd24fb0d6963f7d28e17f72"}}, // Test case - 11-14. // Validating for success cases. @@ -144,11 +144,11 @@ func testObjectAPIPutObject(obj ObjectLayer, instanceType string, t TestErrHandl // Test case 24-26. // data with invalid md5sum in header {bucket, object, data, invalidMD5Header, "", int64(len(data)), getMD5Hash(data), - hash.BadDigest{invalidMD5, getMD5Hash(data)}}, + hash.BadDigest{ExpectedMD5: invalidMD5, CalculatedMD5: getMD5Hash(data)}}, {bucket, object, nilBytes, invalidMD5Header, "", int64(len(nilBytes)), getMD5Hash(nilBytes), - hash.BadDigest{invalidMD5, getMD5Hash(nilBytes)}}, + hash.BadDigest{ExpectedMD5: invalidMD5, CalculatedMD5: getMD5Hash(nilBytes)}}, {bucket, object, fiveMBBytes, invalidMD5Header, "", int64(len(fiveMBBytes)), getMD5Hash(fiveMBBytes), - hash.BadDigest{invalidMD5, getMD5Hash(fiveMBBytes)}}, + hash.BadDigest{ExpectedMD5: invalidMD5, CalculatedMD5: getMD5Hash(fiveMBBytes)}}, // Test case 27-29. // data with size different from the actual number of bytes available in the reader diff --git a/cmd/peer-rpc-client-target.go b/cmd/peer-rpc-client-target.go index 4f8fcad7e..3d0996989 100644 --- a/cmd/peer-rpc-client-target.go +++ b/cmd/peer-rpc-client-target.go @@ -44,7 +44,7 @@ func (target *PeerRPCClientTarget) Close() error { // NewPeerRPCClientTarget - creates RPCClient target with given target ID available in remote peer. func NewPeerRPCClientTarget(bucketName string, targetID event.TargetID, rpcClient *PeerRPCClient) *PeerRPCClientTarget { return &PeerRPCClientTarget{ - id: event.TargetID{targetID.ID, targetID.Name + "+" + mustGetUUID()}, + id: event.TargetID{ID: targetID.ID, Name: targetID.Name + "+" + mustGetUUID()}, remoteTargetID: targetID, bucketName: bucketName, rpcClient: rpcClient, diff --git a/pkg/event/target/amqp.go b/pkg/event/target/amqp.go index 3ca24168f..67316d3f0 100644 --- a/pkg/event/target/amqp.go +++ b/pkg/event/target/amqp.go @@ -123,7 +123,7 @@ func (target *AMQPTarget) Send(eventData event.Event) error { } key := eventData.S3.Bucket.Name + "/" + objectName - data, err := json.Marshal(event.Log{eventData.EventName, key, []event.Event{eventData}}) + data, err := json.Marshal(event.Log{EventName: eventData.EventName, Key: key, Records: []event.Event{eventData}}) if err != nil { return err } @@ -154,7 +154,7 @@ func NewAMQPTarget(id string, args AMQPArgs) (*AMQPTarget, error) { } return &AMQPTarget{ - id: event.TargetID{id, "amqp"}, + id: event.TargetID{ID: id, Name: "amqp"}, args: args, conn: conn, }, nil diff --git a/pkg/event/target/elasticsearch.go b/pkg/event/target/elasticsearch.go index 05c0d7705..3e6b95a44 100644 --- a/pkg/event/target/elasticsearch.go +++ b/pkg/event/target/elasticsearch.go @@ -140,7 +140,7 @@ func NewElasticsearchTarget(id string, args ElasticsearchArgs) (*ElasticsearchTa } return &ElasticsearchTarget{ - id: event.TargetID{id, "elasticsearch"}, + id: event.TargetID{ID: id, Name: "elasticsearch"}, args: args, client: client, }, nil diff --git a/pkg/event/target/httpclient.go b/pkg/event/target/httpclient.go index 90f68a0e9..52b27a581 100644 --- a/pkg/event/target/httpclient.go +++ b/pkg/event/target/httpclient.go @@ -135,7 +135,7 @@ func NewHTTPClientTarget(host xnet.Host, w http.ResponseWriter) (*HTTPClientTarg return nil, err } c := &HTTPClientTarget{ - id: event.TargetID{"httpclient" + "+" + uuid + "+" + host.Name, host.Port.String()}, + id: event.TargetID{ID: "httpclient" + "+" + uuid + "+" + host.Name, Name: host.Port.String()}, w: w, eventCh: make(chan []byte), DoneCh: make(chan struct{}), diff --git a/pkg/event/target/kafka.go b/pkg/event/target/kafka.go index e7fefb79a..6ba4a40bd 100644 --- a/pkg/event/target/kafka.go +++ b/pkg/event/target/kafka.go @@ -81,7 +81,7 @@ func (target *KafkaTarget) Send(eventData event.Event) error { } key := eventData.S3.Bucket.Name + "/" + objectName - data, err := json.Marshal(event.Log{eventData.EventName, key, []event.Event{eventData}}) + data, err := json.Marshal(event.Log{EventName: eventData.EventName, Key: key, Records: []event.Event{eventData}}) if err != nil { return err } @@ -129,7 +129,7 @@ func NewKafkaTarget(id string, args KafkaArgs) (*KafkaTarget, error) { } return &KafkaTarget{ - id: event.TargetID{id, "kafka"}, + id: event.TargetID{ID: id, Name: "kafka"}, args: args, producer: producer, }, nil diff --git a/pkg/event/target/mqtt.go b/pkg/event/target/mqtt.go index bc5dcda01..ed9a38b04 100644 --- a/pkg/event/target/mqtt.go +++ b/pkg/event/target/mqtt.go @@ -89,7 +89,7 @@ func (target *MQTTTarget) Send(eventData event.Event) error { } key := eventData.S3.Bucket.Name + "/" + objectName - data, err := json.Marshal(event.Log{eventData.EventName, key, []event.Event{eventData}}) + data, err := json.Marshal(event.Log{EventName: eventData.EventName, Key: key, Records: []event.Event{eventData}}) if err != nil { return err } @@ -127,7 +127,7 @@ func NewMQTTTarget(id string, args MQTTArgs) (*MQTTTarget, error) { } return &MQTTTarget{ - id: event.TargetID{id, "mqtt"}, + id: event.TargetID{ID: id, Name: "mqtt"}, args: args, client: client, }, nil diff --git a/pkg/event/target/mysql.go b/pkg/event/target/mysql.go index b340d990d..9be7f1e67 100644 --- a/pkg/event/target/mysql.go +++ b/pkg/event/target/mysql.go @@ -254,7 +254,7 @@ func NewMySQLTarget(id string, args MySQLArgs) (*MySQLTarget, error) { } return &MySQLTarget{ - id: event.TargetID{id, "mysql"}, + id: event.TargetID{ID: id, Name: "mysql"}, args: args, updateStmt: updateStmt, deleteStmt: deleteStmt, diff --git a/pkg/event/target/nats.go b/pkg/event/target/nats.go index 8d06f494c..fc852b863 100644 --- a/pkg/event/target/nats.go +++ b/pkg/event/target/nats.go @@ -93,7 +93,7 @@ func (target *NATSTarget) Send(eventData event.Event) (err error) { } key := eventData.S3.Bucket.Name + "/" + objectName - data, err := json.Marshal(event.Log{eventData.EventName, key, []event.Event{eventData}}) + data, err := json.Marshal(event.Log{EventName: eventData.EventName, Key: key, Records: []event.Event{eventData}}) if err != nil { return err } @@ -165,7 +165,7 @@ func NewNATSTarget(id string, args NATSArgs) (*NATSTarget, error) { } return &NATSTarget{ - id: event.TargetID{id, "nats"}, + id: event.TargetID{ID: id, Name: "nats"}, args: args, stanConn: stanConn, natsConn: natsConn, diff --git a/pkg/event/target/nsq.go b/pkg/event/target/nsq.go index c57e2c751..258cb7104 100644 --- a/pkg/event/target/nsq.go +++ b/pkg/event/target/nsq.go @@ -76,7 +76,7 @@ func (target *NSQTarget) Send(eventData event.Event) (err error) { } key := eventData.S3.Bucket.Name + "/" + objectName - data, err := json.Marshal(event.Log{eventData.EventName, key, []event.Event{eventData}}) + data, err := json.Marshal(event.Log{EventName: eventData.EventName, Key: key, Records: []event.Event{eventData}}) if err != nil { return err } @@ -109,7 +109,7 @@ func NewNSQTarget(id string, args NSQArgs) (*NSQTarget, error) { } return &NSQTarget{ - id: event.TargetID{id, "nsq"}, + id: event.TargetID{ID: id, Name: "nsq"}, args: args, producer: producer, }, nil diff --git a/pkg/event/target/postgresql.go b/pkg/event/target/postgresql.go index 6be9380c1..a5936e393 100644 --- a/pkg/event/target/postgresql.go +++ b/pkg/event/target/postgresql.go @@ -259,7 +259,7 @@ func NewPostgreSQLTarget(id string, args PostgreSQLArgs) (*PostgreSQLTarget, err } return &PostgreSQLTarget{ - id: event.TargetID{id, "postgresql"}, + id: event.TargetID{ID: id, Name: "postgresql"}, args: args, updateStmt: updateStmt, deleteStmt: deleteStmt, diff --git a/pkg/event/target/redis.go b/pkg/event/target/redis.go index 33ab1d2d9..5a9949a08 100644 --- a/pkg/event/target/redis.go +++ b/pkg/event/target/redis.go @@ -170,7 +170,7 @@ func NewRedisTarget(id string, args RedisArgs) (*RedisTarget, error) { } return &RedisTarget{ - id: event.TargetID{id, "redis"}, + id: event.TargetID{ID: id, Name: "redis"}, args: args, pool: pool, }, nil diff --git a/pkg/event/target/webhook.go b/pkg/event/target/webhook.go index 9ca49f6de..766787a80 100644 --- a/pkg/event/target/webhook.go +++ b/pkg/event/target/webhook.go @@ -72,7 +72,7 @@ func (target *WebhookTarget) Send(eventData event.Event) error { } key := eventData.S3.Bucket.Name + "/" + objectName - data, err := json.Marshal(event.Log{eventData.EventName, key, []event.Event{eventData}}) + data, err := json.Marshal(event.Log{EventName: eventData.EventName, Key: key, Records: []event.Event{eventData}}) if err != nil { return err } @@ -109,7 +109,7 @@ func (target *WebhookTarget) Close() error { // NewWebhookTarget - creates new Webhook target. func NewWebhookTarget(id string, args WebhookArgs) *WebhookTarget { return &WebhookTarget{ - id: event.TargetID{id, "webhook"}, + id: event.TargetID{ID: id, Name: "webhook"}, args: args, httpClient: &http.Client{ Transport: &http.Transport{