@@ -105,12 +105,12 @@ func newTestDialer() *testDialer {
105
105
// conn := d.waitForNextDialing(true, false)
106
106
// assertReceived(t, // t is *testing.T
107
107
// conn.waitForNextWrite(true, ""),
108
- // "[\ "tag_name\ ",1482493046,{\ "foo\":\ "bar\ "},{}]" )
108
+ // `[ "tag_name",1482493046,{"foo": "bar"},{}]` )
109
109
//
110
110
// f.EncodeAndPostData("something_else", time.Unix(1482493050, 0), map[string]string{"bar": "baz"})
111
111
// assertReceived(t, // t is *testing.T
112
112
// conn.waitForNextWrite(true, ""),
113
- // "[\ "something_else\ ",1482493050,{\ "bar\":\ "baz\ "},{}]" )
113
+ // `[ "something_else",1482493050,{"bar": "baz"},{}]` )
114
114
//
115
115
// In this example, the 1st connection dialing succeeds but the 1st attempt to write the
116
116
// message is discarded. As the logger discards the connection whenever a message
@@ -120,7 +120,7 @@ func newTestDialer() *testDialer {
120
120
// using assertReceived() to make sure the logger encodes the messages properly.
121
121
//
122
122
// Again, the example above is using async mode thus, calls to f and conn are running in
123
- // the same goroutine. However in sync mode, all calls to f.EncodeAndPostData() as well
123
+ // the same goroutine. However, in sync mode, all calls to f.EncodeAndPostData() as well
124
124
// as the logger initialization shall be placed in a separate goroutine or the code
125
125
// allowing the dialing and writing attempts (eg. waitForNextDialing() & waitForNextWrite())
126
126
// would never be reached.
@@ -311,7 +311,8 @@ func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) {
311
311
312
312
f , err := New (Config {
313
313
FluentNetwork : network ,
314
- FluentSocketPath : socketFile })
314
+ FluentSocketPath : socketFile ,
315
+ })
315
316
if err != nil {
316
317
t .Error (err )
317
318
return
@@ -324,7 +325,8 @@ func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) {
324
325
network = "unixxxx"
325
326
fUnknown , err := New (Config {
326
327
FluentNetwork : network ,
327
- FluentSocketPath : socketFile })
328
+ FluentSocketPath : socketFile ,
329
+ })
328
330
if _ , ok := err .(* ErrUnknownNetwork ); ! ok {
329
331
t .Errorf ("err type: %T" , err )
330
332
}
@@ -350,12 +352,12 @@ func Test_MarshalAsMsgpack(t *testing.T) {
350
352
f := & Fluent {Config : Config {}}
351
353
352
354
tag := "tag"
353
- var data = map [string ]string {
355
+ data : = map [string ]string {
354
356
"foo" : "bar" ,
355
- "hoge" : "hoge" }
357
+ "hoge" : "hoge" ,
358
+ }
356
359
tm := time .Unix (1267867237 , 0 )
357
360
result , err := f .EncodeData (tag , tm , data )
358
-
359
361
if err != nil {
360
362
t .Error (err )
361
363
}
@@ -383,7 +385,6 @@ func Test_SubSecondPrecision(t *testing.T) {
383
385
encodedData , err := fluent .EncodeData ("tag" , timestamp , map [string ]string {
384
386
"foo" : "bar" ,
385
387
})
386
-
387
388
// Assert no encoding errors and that the timestamp has been encoded into
388
389
// the message as expected.
389
390
if err != nil {
@@ -402,12 +403,12 @@ func Test_SubSecondPrecision(t *testing.T) {
402
403
func Test_MarshalAsJSON (t * testing.T ) {
403
404
f := & Fluent {Config : Config {MarshalAsJSON : true }}
404
405
405
- var data = map [string ]string {
406
+ data : = map [string ]string {
406
407
"foo" : "bar" ,
407
- "hoge" : "hoge" }
408
+ "hoge" : "hoge" ,
409
+ }
408
410
tm := time .Unix (1267867237 , 0 )
409
411
result , err := f .EncodeData ("tag" , tm , data )
410
-
411
412
if err != nil {
412
413
t .Error (err )
413
414
}
@@ -494,14 +495,14 @@ func TestPostWithTime(t *testing.T) {
494
495
conn := d .waitForNextDialing (true , false )
495
496
assertReceived (t ,
496
497
conn .waitForNextWrite (true , "" ),
497
- "[ \ " acme.tag_name\ " ,1482493046,{\ " foo\" : \ " bar\ " },{}]" )
498
+ `[ "acme.tag_name",1482493046,{"foo": "bar"},{}]` )
498
499
499
500
assertReceived (t ,
500
501
conn .waitForNextWrite (true , "" ),
501
- "[ \ " acme.tag_name\ " ,1482493050,{\ " fluentd\" : \ " is awesome\ " },{}]" )
502
+ `[ "acme.tag_name",1482493050,{"fluentd": "is awesome"},{}]` )
502
503
assertReceived (t ,
503
504
conn .waitForNextWrite (true , "" ),
504
- "[ \ " acme.tag_name\ " ,1634263200,{\ " welcome\" : \ " to use\ " },{}]" )
505
+ `[ "acme.tag_name",1634263200,{"welcome": "to use"},{}]` )
505
506
})
506
507
}
507
508
}
@@ -545,7 +546,7 @@ func TestReconnectAndResendAfterTransientFailure(t *testing.T) {
545
546
conn := d .waitForNextDialing (true , false )
546
547
assertReceived (t ,
547
548
conn .waitForNextWrite (true , "" ),
548
- "[ \ " tag_name\ " ,1482493046,{\ " foo\" : \ " bar\ " },{}]" )
549
+ `[ "tag_name",1482493046,{"foo": "bar"},{}]` )
549
550
550
551
// The next write will fail and the next connection dialing will be dropped
551
552
// to test if the logger is reconnecting as expected.
@@ -556,7 +557,7 @@ func TestReconnectAndResendAfterTransientFailure(t *testing.T) {
556
557
conn = d .waitForNextDialing (true , false )
557
558
assertReceived (t ,
558
559
conn .waitForNextWrite (true , "" ),
559
- "[ \ " tag_name\ " ,1482493050,{\ " fluentd\" : \ " is awesome\ " },{}]" )
560
+ `[ "tag_name",1482493050,{"fluentd": "is awesome"},{}]` )
560
561
})
561
562
}
562
563
}
0 commit comments