@@ -105,12 +105,12 @@ func newTestDialer() *testDialer {
105105// conn := d.waitForNextDialing(true, false)
106106// assertReceived(t, // t is *testing.T
107107// conn.waitForNextWrite(true, ""),
108- // "[\ "tag_name\ ",1482493046,{\ "foo\":\ "bar\ "},{}]" )
108+ // `[ "tag_name",1482493046,{"foo": "bar"},{}]` )
109109//
110110// f.EncodeAndPostData("something_else", time.Unix(1482493050, 0), map[string]string{"bar": "baz"})
111111// assertReceived(t, // t is *testing.T
112112// conn.waitForNextWrite(true, ""),
113- // "[\ "something_else\ ",1482493050,{\ "bar\":\ "baz\ "},{}]" )
113+ // `[ "something_else",1482493050,{"bar": "baz"},{}]` )
114114//
115115// In this example, the 1st connection dialing succeeds but the 1st attempt to write the
116116// message is discarded. As the logger discards the connection whenever a message
@@ -120,7 +120,7 @@ func newTestDialer() *testDialer {
120120// using assertReceived() to make sure the logger encodes the messages properly.
121121//
122122// 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
124124// as the logger initialization shall be placed in a separate goroutine or the code
125125// allowing the dialing and writing attempts (eg. waitForNextDialing() & waitForNextWrite())
126126// would never be reached.
@@ -311,7 +311,8 @@ func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) {
311311
312312 f, err := New(Config{
313313 FluentNetwork: network,
314- FluentSocketPath: socketFile})
314+ FluentSocketPath: socketFile,
315+ })
315316 if err != nil {
316317 t.Error(err)
317318 return
@@ -324,7 +325,8 @@ func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) {
324325 network = "unixxxx"
325326 fUnknown, err := New(Config{
326327 FluentNetwork: network,
327- FluentSocketPath: socketFile})
328+ FluentSocketPath: socketFile,
329+ })
328330 if _, ok := err.(*ErrUnknownNetwork); !ok {
329331 t.Errorf("err type: %T", err)
330332 }
@@ -350,12 +352,12 @@ func Test_MarshalAsMsgpack(t *testing.T) {
350352 f := &Fluent{Config: Config{}}
351353
352354 tag := "tag"
353- var data = map[string]string{
355+ data : = map[string]string{
354356 "foo": "bar",
355- "hoge": "hoge"}
357+ "hoge": "hoge",
358+ }
356359 tm := time.Unix(1267867237, 0)
357360 result, err := f.EncodeData(tag, tm, data)
358-
359361 if err != nil {
360362 t.Error(err)
361363 }
@@ -383,7 +385,6 @@ func Test_SubSecondPrecision(t *testing.T) {
383385 encodedData, err := fluent.EncodeData("tag", timestamp, map[string]string{
384386 "foo": "bar",
385387 })
386-
387388 // Assert no encoding errors and that the timestamp has been encoded into
388389 // the message as expected.
389390 if err != nil {
@@ -402,12 +403,12 @@ func Test_SubSecondPrecision(t *testing.T) {
402403func Test_MarshalAsJSON(t *testing.T) {
403404 f := &Fluent{Config: Config{MarshalAsJSON: true}}
404405
405- var data = map[string]string{
406+ data : = map[string]string{
406407 "foo": "bar",
407- "hoge": "hoge"}
408+ "hoge": "hoge",
409+ }
408410 tm := time.Unix(1267867237, 0)
409411 result, err := f.EncodeData("tag", tm, data)
410-
411412 if err != nil {
412413 t.Error(err)
413414 }
@@ -494,14 +495,14 @@ func TestPostWithTime(t *testing.T) {
494495 conn := d.waitForNextDialing(true, false)
495496 assertReceived(t,
496497 conn.waitForNextWrite(true, ""),
497- "[\ "acme.tag_name\ ",1482493046,{\ "foo\":\ "bar\ "},{}]" )
498+ `[ "acme.tag_name",1482493046,{"foo": "bar"},{}]` )
498499
499500 assertReceived(t,
500501 conn.waitForNextWrite(true, ""),
501- "[\ "acme.tag_name\ ",1482493050,{\ "fluentd\":\ "is awesome\ "},{}]" )
502+ `[ "acme.tag_name",1482493050,{"fluentd": "is awesome"},{}]` )
502503 assertReceived(t,
503504 conn.waitForNextWrite(true, ""),
504- "[\ "acme.tag_name\ ",1634263200,{\ "welcome\":\ "to use\ "},{}]" )
505+ `[ "acme.tag_name",1634263200,{"welcome": "to use"},{}]` )
505506 })
506507 }
507508}
@@ -545,7 +546,7 @@ func TestReconnectAndResendAfterTransientFailure(t *testing.T) {
545546 conn := d.waitForNextDialing(true, false)
546547 assertReceived(t,
547548 conn.waitForNextWrite(true, ""),
548- "[\ "tag_name\ ",1482493046,{\ "foo\":\ "bar\ "},{}]" )
549+ `[ "tag_name",1482493046,{"foo": "bar"},{}]` )
549550
550551 // The next write will fail and the next connection dialing will be dropped
551552 // to test if the logger is reconnecting as expected.
@@ -556,7 +557,7 @@ func TestReconnectAndResendAfterTransientFailure(t *testing.T) {
556557 conn = d.waitForNextDialing(true, false)
557558 assertReceived(t,
558559 conn.waitForNextWrite(true, ""),
559- "[\ "tag_name\ ",1482493050,{\ "fluentd\":\ "is awesome\ "},{}]" )
560+ `[ "tag_name",1482493050,{"fluentd": "is awesome"},{}]` )
560561 })
561562 }
562563}
0 commit comments