From 050b7b93b1d730844670fff2b1b21fdbbd4f146d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Dec 2022 13:48:15 +0100 Subject: [PATCH 01/11] gha: update actions/checkout@v3, actions/setup-go@v4 Signed-off-by: Sebastiaan van Stijn --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8d8e905..1b1a62d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,12 +15,12 @@ jobs: matrix: os: [ubuntu, macos, windows] golang: ['1.13', '1.16', '1.17'] - # currently, we cannot run non-x86_64 machines on Github Actions cloud env. + # currently, we cannot run non-x86_64 machines on GitHub Actions cloud env. runs-on: ${{ matrix.os }}-latest name: CI golang ${{ matrix.golang }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: go-version: ${{ matrix.golang }} - name: Change GO11MODULES From edf7dade0a9c2d1f7a1abf8bf4028ce52329bb74 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Dec 2022 13:56:12 +0100 Subject: [PATCH 02/11] all: gofmt code for current go versions Signed-off-by: Sebastiaan van Stijn --- README.md | 45 +++++++++--------- _examples/main.go | 7 +-- fluent/fluent.go | 44 +++++++++--------- fluent/fluent_test.go | 104 ++++++++++++++++++++++-------------------- 4 files changed, 102 insertions(+), 98 deletions(-) diff --git a/README.md b/README.md index d0b6b23..8a8a741 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,15 @@ fluent-logger-golang ## How to install -``` -go get github.com/fluent/fluent-logger-golang/fluent +```bash +go get github.com/fluent/fluent-logger-golang/fluent@latest ``` ## Usage Install the package with `go get` and use `import` to include it in your project. -``` +```go import "github.com/fluent/fluent-logger-golang/fluent" ``` @@ -26,27 +26,28 @@ import "github.com/fluent/fluent-logger-golang/fluent" package main import ( - "github.com/fluent/fluent-logger-golang/fluent" - "fmt" - //"time" + "fmt" + // "time" + + "github.com/fluent/fluent-logger-golang/fluent" ) func main() { - logger, err := fluent.New(fluent.Config{}) - if err != nil { - fmt.Println(err) - } - defer logger.Close() - tag := "myapp.access" - var data = map[string]string{ - "foo": "bar", - "hoge": "hoge", - } - error := logger.Post(tag, data) - // error := logger.PostWithTime(tag, time.Now(), data) - if error != nil { - panic(error) - } + logger, err := fluent.New(fluent.Config{}) + if err != nil { + fmt.Println(err) + } + defer logger.Close() + tag := "myapp.access" + data := map[string]string{ + "foo": "bar", + "hoge": "hoge", + } + error := logger.Post(tag, data) + // error = logger.PostWithTime(tag, time.Now(), data) + if error != nil { + panic(error) + } } ``` @@ -181,7 +182,7 @@ were involved. Starting v1.8.0, the logger no longer accepts `Fluent.Post()` after `Fluent.Close()`, and instead returns a "Logger already closed" error. ## Tests -``` +```bash go test ``` diff --git a/_examples/main.go b/_examples/main.go index cb3e2e2..77d8d90 100644 --- a/_examples/main.go +++ b/_examples/main.go @@ -5,7 +5,7 @@ import ( "log" "time" - "../fluent" + "github.com/fluent/fluent-logger-golang/fluent" ) func main() { @@ -15,9 +15,10 @@ func main() { } defer logger.Close() tag := "myapp.access" - var data = map[string]string{ + data := map[string]string{ "foo": "bar", - "hoge": "hoge"} + "hoge": "hoge", + } for i := 0; i < 100; i++ { e := logger.Post(tag, data) if e != nil { diff --git a/fluent/fluent.go b/fluent/fluent.go index 7216991..15e323f 100644 --- a/fluent/fluent.go +++ b/fluent/fluent.go @@ -1,8 +1,11 @@ package fluent import ( + "bytes" "context" "crypto/tls" + "encoding/base64" + "encoding/binary" "encoding/json" "errors" "fmt" @@ -15,10 +18,6 @@ import ( "sync" "time" - "bytes" - "encoding/base64" - "encoding/binary" - "github.com/tinylib/msgp/msgp" ) @@ -200,27 +199,26 @@ func newWithDialer(config Config, d dialer) (f *Fluent, err error) { // // Examples: // -// // send map[string] -// mapStringData := map[string]string{ -// "foo": "bar", -// } -// f.Post("tag_name", mapStringData) -// -// // send message with specified time -// mapStringData := map[string]string{ -// "foo": "bar", -// } -// tm := time.Now() -// f.PostWithTime("tag_name", tm, mapStringData) +// // send map[string] +// mapStringData := map[string]string{ +// "foo": "bar", +// } +// f.Post("tag_name", mapStringData) // -// // send struct -// structData := struct { -// Name string `msg:"name"` -// } { -// "john smith", -// } -// f.Post("tag_name", structData) +// // send message with specified time +// mapStringData := map[string]string{ +// "foo": "bar", +// } +// tm := time.Now() +// f.PostWithTime("tag_name", tm, mapStringData) // +// // send struct +// structData := struct { +// Name string `msg:"name"` +// } { +// "john smith", +// } +// f.Post("tag_name", structData) func (f *Fluent) Post(tag string, message interface{}) error { timeNow := time.Now() return f.PostWithTime(tag, timeNow, message) diff --git a/fluent/fluent_test.go b/fluent/fluent_test.go index 00a6086..e5866f7 100644 --- a/fluent/fluent_test.go +++ b/fluent/fluent_test.go @@ -45,18 +45,18 @@ func newTestDialer() *testDialer { // For instance, to test an async logger that have to dial 4 times before succeeding, // the test should look like this: // -// d := newTestDialer() // Create a new stubbed dialer -// cfg := Config{ -// Async: true, -// // ... -// } -// f := newWithDialer(cfg, d) // Create a fluent logger using the stubbed dialer -// f.EncodeAndPostData("tag_name", time.Unix(1482493046, 0), map[string]string{"foo": "bar"}) +// d := newTestDialer() // Create a new stubbed dialer +// cfg := Config{ +// Async: true, +// // ... +// } +// f := newWithDialer(cfg, d) // Create a fluent logger using the stubbed dialer +// f.EncodeAndPostData("tag_name", time.Unix(1482493046, 0), map[string]string{"foo": "bar"}) // -// d.waitForNextDialing(false, false) // 1st dialing attempt fails -// d.waitForNextDialing(false, false) // 2nd attempt fails too -// d.waitForNextDialing(false, false) // 3rd attempt fails too -// d.waitForNextDialing(true, false) // Finally the 4th attempt succeeds +// d.waitForNextDialing(false, false) // 1st dialing attempt fails +// d.waitForNextDialing(false, false) // 2nd attempt fails too +// d.waitForNextDialing(false, false) // 3rd attempt fails too +// d.waitForNextDialing(true, false) // Finally the 4th attempt succeeds // // Note that in the above example, the logger operates in async mode. As such, // a call to Post, PostWithTime or EncodeAndPostData is needed *before* calling @@ -67,20 +67,20 @@ func newTestDialer() *testDialer { // case, you have to put the calls to newWithDialer() and to EncodeAndPostData() // into their own goroutine. An example: // -// d := newTestDialer() // Create a new stubbed dialer -// cfg := Config{ -// Async: false, -// // ... -// } -// go func() { -// f := newWithDialer(cfg, d) // Create a fluent logger using the stubbed dialer -// f.Close() -// }() +// d := newTestDialer() // Create a new stubbed dialer +// cfg := Config{ +// Async: false, +// // ... +// } +// go func() { +// f := newWithDialer(cfg, d) // Create a fluent logger using the stubbed dialer +// f.Close() +// }() // -// d.waitForNextDialing(false, false) // 1st dialing attempt fails -// d.waitForNextDialing(false, false) // 2nd attempt fails too -// d.waitForNextDialing(false, false) // 3rd attempt fails too -// d.waitForNextDialing(true, false) // Finally the 4th attempt succeeds +// d.waitForNextDialing(false, false) // 1st dialing attempt fails +// d.waitForNextDialing(false, false) // 2nd attempt fails too +// d.waitForNextDialing(false, false) // 3rd attempt fails too +// d.waitForNextDialing(true, false) // Finally the 4th attempt succeeds // // Moreover, waitForNextDialing() returns a *Conn which extends net.Conn to provide testing // facilities. For instance, you can call waitForNextWrite() on these connections, to @@ -91,24 +91,24 @@ func newTestDialer() *testDialer { // // Here's a full example: // -// d := newTestDialer() -// cfg := Config{Async: true} +// d := newTestDialer() +// cfg := Config{Async: true} // -// f := newWithDialer(cfg, d) -// f.EncodeAndPostData("tag_name", time.Unix(1482493046, 0), map[string]string{"foo": "bar"}) +// f := newWithDialer(cfg, d) +// f.EncodeAndPostData("tag_name", time.Unix(1482493046, 0), map[string]string{"foo": "bar"}) // -// conn := d.waitForNextDialing(true, false) // Accept the dialing -// conn.waitForNextWrite(false, "") // Discard the 1st attempt to write the message +// conn := d.waitForNextDialing(true, false) // Accept the dialing +// conn.waitForNextWrite(false, "") // Discard the 1st attempt to write the message // -// conn := d.waitForNextDialing(true, false) -// assertReceived(t, // t is *testing.T -// conn.waitForNextWrite(true, ""), -// "[\"tag_name\",1482493046,{\"foo\":\"bar\"},{}]") +// conn := d.waitForNextDialing(true, false) +// assertReceived(t, // t is *testing.T +// conn.waitForNextWrite(true, ""), +// "[\"tag_name\",1482493046,{\"foo\":\"bar\"},{}]") // -// f.EncodeAndPostData("something_else", time.Unix(1482493050, 0), map[string]string{"bar": "baz"}) -// assertReceived(t, // t is *testing.T -// conn.waitForNextWrite(true, ""), -// "[\"something_else\",1482493050,{\"bar\":\"baz\"},{}]") +// f.EncodeAndPostData("something_else", time.Unix(1482493050, 0), map[string]string{"bar": "baz"}) +// assertReceived(t, // t is *testing.T +// conn.waitForNextWrite(true, ""), +// "[\"something_else\",1482493050,{\"bar\":\"baz\"},{}]") // // In this example, the 1st connection dialing succeeds but the 1st attempt to write the // message is discarded. As the logger discards the connection whenever a message @@ -296,7 +296,8 @@ func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) { f, err := New(Config{ FluentNetwork: network, - FluentSocketPath: socketFile}) + FluentSocketPath: socketFile, + }) if err != nil { t.Error(err) return @@ -309,7 +310,8 @@ func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) { network = "unixxxx" fUnknown, err := New(Config{ FluentNetwork: network, - FluentSocketPath: socketFile}) + FluentSocketPath: socketFile, + }) if _, ok := err.(*ErrUnknownNetwork); !ok { t.Errorf("err type: %T", err) } @@ -335,12 +337,12 @@ func Test_MarshalAsMsgpack(t *testing.T) { f := &Fluent{Config: Config{}} tag := "tag" - var data = map[string]string{ + data := map[string]string{ "foo": "bar", - "hoge": "hoge"} + "hoge": "hoge", + } tm := time.Unix(1267867237, 0) result, err := f.EncodeData(tag, tm, data) - if err != nil { t.Error(err) } @@ -368,7 +370,6 @@ func Test_SubSecondPrecision(t *testing.T) { encodedData, err := fluent.EncodeData("tag", timestamp, map[string]string{ "foo": "bar", }) - // Assert no encoding errors and that the timestamp has been encoded into // the message as expected. if err != nil { @@ -387,12 +388,12 @@ func Test_SubSecondPrecision(t *testing.T) { func Test_MarshalAsJSON(t *testing.T) { f := &Fluent{Config: Config{MarshalAsJSON: true}} - var data = map[string]string{ + data := map[string]string{ "foo": "bar", - "hoge": "hoge"} + "hoge": "hoge", + } tm := time.Unix(1267867237, 0) result, err := f.EncodeData("tag", tm, data) - if err != nil { t.Error(err) } @@ -472,7 +473,10 @@ func TestPostWithTime(t *testing.T) { _ = f.PostWithTime("tag_name", time.Unix(1482493046, 0), map[string]string{"foo": "bar"}) _ = f.PostWithTime("tag_name", time.Unix(1482493050, 0), map[string]string{"fluentd": "is awesome"}) _ = f.PostWithTime("tag_name", time.Unix(1634263200, 0), - struct {Welcome string `msg:"welcome"`; cannot string}{"to use", "see me"}) + struct { + Welcome string `msg:"welcome"` + cannot string + }{"to use", "see me"}) }() conn := d.waitForNextDialing(true, false) @@ -755,10 +759,10 @@ func TestSyncWriteAfterCloseFails(t *testing.T) { err = f.PostWithTime("tag_name", time.Unix(1482493050, 0), map[string]string{"foo": "buzz"}) // The event submission must fail, - assert.NotEqual(t, err, nil); + assert.NotEqual(t, err, nil) // and also must keep Fluentd closed. - assert.NotEqual(t, f.closed, false); + assert.NotEqual(t, f.closed, false) }() conn := d.waitForNextDialing(true, false) From 940c2a68fe93bd5242fc58dc24489a861751f9dc Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Dec 2022 14:23:28 +0100 Subject: [PATCH 03/11] fix example in README Signed-off-by: Sebastiaan van Stijn --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8a8a741..f76c8b2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ package main import ( "fmt" - // "time" + "time" "github.com/fluent/fluent-logger-golang/fluent" ) @@ -43,10 +43,14 @@ func main() { "foo": "bar", "hoge": "hoge", } - error := logger.Post(tag, data) - // error = logger.PostWithTime(tag, time.Now(), data) - if error != nil { - panic(error) + err = logger.Post(tag, data) + if err != nil { + panic(err) + } + + err = logger.PostWithTime(tag, time.Now(), data) + if err != nil { + panic(err) } } ``` From b8e5e2f603d76c543eae799bc7cb038b282d0a3a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Dec 2022 14:26:20 +0100 Subject: [PATCH 04/11] use string-literals to prevent having to escape quotes This makes the code and examples slightly more readable. Signed-off-by: Sebastiaan van Stijn --- fluent/fluent.go | 2 +- fluent/fluent_test.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fluent/fluent.go b/fluent/fluent.go index 15e323f..b00c3c6 100644 --- a/fluent/fluent.go +++ b/fluent/fluent.go @@ -315,7 +315,7 @@ func (chunk *MessageChunk) MarshalJSON() ([]byte, error) { if err != nil { return nil, err } - return []byte(fmt.Sprintf("[\"%s\",%d,%s,%s]", chunk.message.Tag, + return []byte(fmt.Sprintf(`["%s",%d,%s,%s]`, chunk.message.Tag, chunk.message.Time, data, option)), err } diff --git a/fluent/fluent_test.go b/fluent/fluent_test.go index e5866f7..0895499 100644 --- a/fluent/fluent_test.go +++ b/fluent/fluent_test.go @@ -103,12 +103,12 @@ func newTestDialer() *testDialer { // conn := d.waitForNextDialing(true, false) // assertReceived(t, // t is *testing.T // conn.waitForNextWrite(true, ""), -// "[\"tag_name\",1482493046,{\"foo\":\"bar\"},{}]") +// `["tag_name",1482493046,{"foo":"bar"},{}]`) // // f.EncodeAndPostData("something_else", time.Unix(1482493050, 0), map[string]string{"bar": "baz"}) // assertReceived(t, // t is *testing.T // conn.waitForNextWrite(true, ""), -// "[\"something_else\",1482493050,{\"bar\":\"baz\"},{}]") +// `["something_else",1482493050,{"bar":"baz"},{}]`) // // In this example, the 1st connection dialing succeeds but the 1st attempt to write the // message is discarded. As the logger discards the connection whenever a message @@ -118,7 +118,7 @@ func newTestDialer() *testDialer { // using assertReceived() to make sure the logger encodes the messages properly. // // Again, the example above is using async mode thus, calls to f and conn are running in -// the same goroutine. However in sync mode, all calls to f.EncodeAndPostData() as well +// the same goroutine. However, in sync mode, all calls to f.EncodeAndPostData() as well // as the logger initialization shall be placed in a separate goroutine or the code // allowing the dialing and writing attempts (eg. waitForNextDialing() & waitForNextWrite()) // would never be reached. @@ -482,14 +482,14 @@ func TestPostWithTime(t *testing.T) { conn := d.waitForNextDialing(true, false) assertReceived(t, conn.waitForNextWrite(true, ""), - "[\"acme.tag_name\",1482493046,{\"foo\":\"bar\"},{}]") + `["acme.tag_name",1482493046,{"foo":"bar"},{}]`) assertReceived(t, conn.waitForNextWrite(true, ""), - "[\"acme.tag_name\",1482493050,{\"fluentd\":\"is awesome\"},{}]") + `["acme.tag_name",1482493050,{"fluentd":"is awesome"},{}]`) assertReceived(t, conn.waitForNextWrite(true, ""), - "[\"acme.tag_name\",1634263200,{\"welcome\":\"to use\"},{}]") + `["acme.tag_name",1634263200,{"welcome":"to use"},{}]`) }) } } @@ -533,7 +533,7 @@ func TestReconnectAndResendAfterTransientFailure(t *testing.T) { conn := d.waitForNextDialing(true, false) assertReceived(t, conn.waitForNextWrite(true, ""), - "[\"tag_name\",1482493046,{\"foo\":\"bar\"},{}]") + `["tag_name",1482493046,{"foo":"bar"},{}]`) // The next write will fail and the next connection dialing will be dropped // to test if the logger is reconnecting as expected. @@ -544,7 +544,7 @@ func TestReconnectAndResendAfterTransientFailure(t *testing.T) { conn = d.waitForNextDialing(true, false) assertReceived(t, conn.waitForNextWrite(true, ""), - "[\"tag_name\",1482493050,{\"fluentd\":\"is awesome\"},{}]") + `["tag_name",1482493050,{"fluentd":"is awesome"},{}]`) }) } } From 4ff6d9716ac21ee9e5cae4bbf15a6012f0199c76 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Dec 2022 14:37:19 +0100 Subject: [PATCH 05/11] tests: make sure to capture test-case in loop TestNoPanicOnAsyncClose was not capturing the testcase, but running with t.Parallel(). Also updated other tests to use the same approach, and renamed variables for consistency. Signed-off-by: Sebastiaan van Stijn --- fluent/fluent_test.go | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/fluent/fluent_test.go b/fluent/fluent_test.go index 0895499..e619252 100644 --- a/fluent/fluent_test.go +++ b/fluent/fluent_test.go @@ -451,9 +451,9 @@ func TestPostWithTime(t *testing.T) { }, } - for tcname := range testcases { + for tcname, tc := range testcases { + tc := tc t.Run(tcname, func(t *testing.T) { - tc := testcases[tcname] t.Parallel() d := newTestDialer() @@ -506,9 +506,9 @@ func TestReconnectAndResendAfterTransientFailure(t *testing.T) { }, } - for tcname := range testcases { + for tcname, tc := range testcases { + tc := tc t.Run(tcname, func(t *testing.T) { - tc := testcases[tcname] t.Parallel() d := newTestDialer() @@ -588,9 +588,9 @@ func TestCloseOnFailingAsyncConnect(t *testing.T) { }, } - for tcname := range testcases { + for tcname, tc := range testcases { + tc := tc t.Run(tcname, func(t *testing.T) { - tc := testcases[tcname] t.Parallel() d := newTestDialer() @@ -636,22 +636,23 @@ func TestNoPanicOnAsyncClose(t *testing.T) { shouldError: false, }, } - for _, testcase := range testcases { - t.Run(testcase.name, func(t *testing.T) { + for _, tc := range testcases { + tc := tc + t.Run(tc.name, func(t *testing.T) { t.Parallel() d := newTestDialer() - f, err := newWithDialer(testcase.config, d) + f, err := newWithDialer(tc.config, d) if err != nil { t.Errorf("Unexpected error: %v", err) } - if testcase.shouldError { + if tc.shouldError { f.Close() } - e := f.EncodeAndPostData("tag_name", time.Unix(1482493046, 0), map[string]string{"foo": "bar"}) - if testcase.shouldError { - assert.Equal(t, fmt.Errorf("fluent#appendBuffer: Logger already closed"), e) + err = f.EncodeAndPostData("tag_name", time.Unix(1482493046, 0), map[string]string{"foo": "bar"}) + if tc.shouldError { + assert.Equal(t, fmt.Errorf("fluent#appendBuffer: Logger already closed"), err) } else { - assert.Equal(t, nil, e) + assert.Equal(t, nil, err) } }) } @@ -684,9 +685,9 @@ func TestCloseOnFailingAsyncReconnect(t *testing.T) { }, } - for tcname := range testcases { + for tcname, tc := range testcases { + tc := tc t.Run(tcname, func(t *testing.T) { - tc := testcases[tcname] t.Parallel() d := newTestDialer() From 08687f1bd92c02d15aba67c9909ea9418d215680 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Dec 2022 15:16:08 +0100 Subject: [PATCH 06/11] remove use of deprecated github.com/bmizerany/assert package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The github.com/bmizerany/assert module has been deprecated and is no longer maintained. In addition, the dependency brings various indirect dependencies with it; module github.com/fluent/fluent-logger-golang go 1.19 require ( github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 github.com/tinylib/msgp v1.1.6 ) require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/philhofer/fwd v1.1.1 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect ) The assertion package itself also looks to have some issues. For example, it's not marked as a `t.Helper()`, and while it includes the location of the error in the output, the failures are prefixed with the location of the assertion itself, which is somewhat confusing: === RUN Test_New_itShouldUseDefaultConfigValuesIfNoOtherProvided assert.go:15: /Users/thajeztah/go/src/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go:275 assert.go:62: ! Unexpected: <24224> --- FAIL: Test_New_itShouldUseDefaultConfigValuesIfNoOtherProvided (0.00s) === RUN Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified assert.go:15: /Users/thajeztah/go/src/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go:306 assert.go:62: ! Unexpected: <"unix"> --- FAIL: Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified (0.00s) === RUN Test_New_itShouldUseConfigValuesFromArguments assert.go:15: /Users/thajeztah/go/src/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go:327 assert.go:62: ! Unexpected: <6666> --- FAIL: Test_New_itShouldUseConfigValuesFromArguments (0.00s) === RUN Test_New_itShouldUseConfigValuesFromMashalAsJSONArgument assert.go:15: /Users/thajeztah/go/src/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go:333 assert.go:62: ! Unexpected: --- FAIL: Test_New_itShouldUseConfigValuesFromMashalAsJSONArgument (0.00s) === CONT TestNoPanicOnAsyncClose/Channel_closed_before_write assert.go:15: /Users/thajeztah/go/src/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go:653 === CONT TestNoPanicOnAsyncClose/Channel_not_closed_at_all assert.go:15: /Users/thajeztah/go/src/github.com/fluent/fluent-logger-golang/fluent/fluent_test.go:655 === CONT TestNoPanicOnAsyncClose/Channel_closed_before_write assert.go:62: ! Unexpected: <&errors.errorString{s:"fluent#appendBuffer: Logger already closed"}> === CONT TestNoPanicOnAsyncClose/Channel_not_closed_at_all assert.go:62: ! Unexpected: <> While a good assertion library can help (for example by printing a rich diff output if a struct does not match), a look at how it's used shows that most cases are comparing primitive types (int, string, bool). This patch swaps the library for a local `assertEqual()` utility. With this patch, test-failures look like the example below: === RUN Test_New_itShouldUseDefaultConfigValuesIfNoOtherProvided fluent_test.go:281: got: '24224', expected: '24224' fluent_test.go:282: got: '127.0.0.1', expected: '127.0.0.1' fluent_test.go:283: got: '3s', expected: '3s' fluent_test.go:284: got: '0s', expected: '0s' fluent_test.go:285: got: '8192', expected: '8192' fluent_test.go:286: got: 'tcp', expected: 'tcp' fluent_test.go:287: got: '', expected: '' --- FAIL: Test_New_itShouldUseDefaultConfigValuesIfNoOtherProvided (0.00s) === RUN Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified fluent_test.go:312: got: 'unix', expected: 'unix' fluent_test.go:313: got: '/tmp/fluent-logger-golang.sock', expected: '/tmp/fluent-logger-golang.sock' --- FAIL: Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified (0.00s) === RUN Test_New_itShouldUseConfigValuesFromArguments fluent_test.go:333: got: '6666', expected: '6666' fluent_test.go:334: got: 'foobarhost', expected: 'foobarhost' --- FAIL: Test_New_itShouldUseConfigValuesFromArguments (0.00s) === RUN Test_New_itShouldUseConfigValuesFromMashalAsJSONArgument fluent_test.go:339: got: 'true', expected: 'true' --- FAIL: Test_New_itShouldUseConfigValuesFromMashalAsJSONArgument (0.00s) === RUN TestJsonConfig fluent_test.go:441: got: '{FluentPort:8888 FluentHost:localhost FluentNetwork:tcp FluentSocketPath:/var/tmp/fluent.sock Timeout:3µs WriteTimeout:6µs BufferLimit:10 RetryWait:5 MaxRetry:3 MaxRetryWait:0 TagPrefix:fluent Async:false ForceStopAsyncSend:false AsyncResultCallback: AsyncConnect:false MarshalAsJSON:true AsyncReconnectInterval:0 SubSecondPrecision:false RequestAck:false TlsInsecureSkipVerify:false}', expected: '{FluentPort:8888 FluentHost:localhost FluentNetwork:tcp FluentSocketPath:/var/tmp/fluent.sock Timeout:3µs WriteTimeout:6µs BufferLimit:10 RetryWait:5 MaxRetry:3 MaxRetryWait:0 TagPrefix:fluent Async:false ForceStopAsyncSend:false AsyncResultCallback: AsyncConnect:false MarshalAsJSON:true AsyncReconnectInterval:0 SubSecondPrecision:false RequestAck:false TlsInsecureSkipVerify:false}' --- FAIL: TestJsonConfig (0.00s) === CONT TestPostWithTime/without_Async fluent_test.go:177: got: '["acme.tag_name",1482493046,{"foo":"bar"},{}]', expected: '["acme.tag_name",1482493046,{"foo":"bar"},{}]' fluent_test.go:177: got: '["acme.tag_name",1482493050,{"fluentd":"is awesome"},{}]', expected: '["acme.tag_name",1482493050,{"fluentd":"is awesome"},{}]' fluent_test.go:177: got: '["acme.tag_name",1634263200,{"welcome":"to use"},{}]', expected: '["acme.tag_name",1634263200,{"welcome":"to use"},{}]' === CONT TestPostWithTime/with_Async fluent_test.go:177: got: '["acme.tag_name",1482493046,{"foo":"bar"},{}]', expected: '["acme.tag_name",1482493046,{"foo":"bar"},{}]' fluent_test.go:177: got: '["acme.tag_name",1482493050,{"fluentd":"is awesome"},{}]', expected: '["acme.tag_name",1482493050,{"fluentd":"is awesome"},{}]' fluent_test.go:177: got: '["acme.tag_name",1634263200,{"welcome":"to use"},{}]', expected: '["acme.tag_name",1634263200,{"welcome":"to use"},{}]' === CONT TestReconnectAndResendAfterTransientFailure/with_Async fluent_test.go:177: got: '["tag_name",1482493046,{"foo":"bar"},{}]', expected: '["tag_name",1482493046,{"foo":"bar"},{}]' === CONT TestReconnectAndResendAfterTransientFailure/without_Async fluent_test.go:177: got: '["tag_name",1482493046,{"foo":"bar"},{}]', expected: '["tag_name",1482493046,{"foo":"bar"},{}]' fluent_test.go:177: got: '["tag_name",1482493050,{"fluentd":"is awesome"},{}]', expected: '["tag_name",1482493050,{"fluentd":"is awesome"},{}]' === CONT TestReconnectAndResendAfterTransientFailure/with_Async fluent_test.go:177: got: '["tag_name",1482493050,{"fluentd":"is awesome"},{}]', expected: '["tag_name",1482493050,{"fluentd":"is awesome"},{}]' === CONT TestNoPanicOnAsyncClose/Channel_closed_before_write fluent_test.go:657: got: 'fluent#appendBuffer: Logger already closed', expected: 'fluent#appendBuffer: Logger already closed' === CONT TestNoPanicOnAsyncClose/Channel_not_closed_at_all fluent_test.go:659: got: '', expected: '' The list of dependencies have also been reduced with this patch: module github.com/fluent/fluent-logger-golang go 1.19 require github.com/tinylib/msgp v1.1.6 require github.com/philhofer/fwd v1.1.1 // indirect Signed-off-by: Sebastiaan van Stijn --- .github/workflows/ci.yaml | 1 - fluent/fluent_test.go | 55 +++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1b1a62d..38b2670 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,6 @@ jobs: run: go env -w GO111MODULE=auto - name: Install requirements run: | - go get github.com/bmizerany/assert go get github.com/philhofer/fwd go get github.com/tinylib/msgp - name: Test diff --git a/fluent/fluent_test.go b/fluent/fluent_test.go index e619252..f7cde0d 100644 --- a/fluent/fluent_test.go +++ b/fluent/fluent_test.go @@ -13,7 +13,6 @@ import ( "testing" "time" - "github.com/bmizerany/assert" "github.com/tinylib/msgp/msgp" ) @@ -162,13 +161,21 @@ func (d *testDialer) waitForNextDialing(accept bool, delayReads bool) *Conn { return conn } +// asserEqual asserts that actual and expected are equivalent, and otherwise +// marks the test as failed (t.Error). It uses reflect.DeepEqual internally. +func assertEqual(t *testing.T, actual, expected interface{}) { + t.Helper() + if !reflect.DeepEqual(actual, expected) { + t.Errorf("got: '%+v', expected: '%+v'", actual, expected) + } +} + // assertReceived is used below by test cases to assert the content written to a *Conn // matches an expected string. This is generally used in conjunction with // Conn.waitForNextWrite(). func assertReceived(t *testing.T, rcv []byte, expected string) { - if string(rcv) != expected { - t.Fatalf("got %s, expect %s", string(rcv), expected) - } + t.Helper() + assertEqual(t, string(rcv), expected) } // Conn extends net.Conn to add channels used to synchronise across goroutines, eg. @@ -272,13 +279,13 @@ func (c *Conn) Close() error { func Test_New_itShouldUseDefaultConfigValuesIfNoOtherProvided(t *testing.T) { f, _ := New(Config{}) - assert.Equal(t, f.Config.FluentPort, defaultPort) - assert.Equal(t, f.Config.FluentHost, defaultHost) - assert.Equal(t, f.Config.Timeout, defaultTimeout) - assert.Equal(t, f.Config.WriteTimeout, defaultWriteTimeout) - assert.Equal(t, f.Config.BufferLimit, defaultBufferLimit) - assert.Equal(t, f.Config.FluentNetwork, defaultNetwork) - assert.Equal(t, f.Config.FluentSocketPath, defaultSocketPath) + assertEqual(t, f.Config.FluentPort, defaultPort) + assertEqual(t, f.Config.FluentHost, defaultHost) + assertEqual(t, f.Config.Timeout, defaultTimeout) + assertEqual(t, f.Config.WriteTimeout, defaultWriteTimeout) + assertEqual(t, f.Config.BufferLimit, defaultBufferLimit) + assertEqual(t, f.Config.FluentNetwork, defaultNetwork) + assertEqual(t, f.Config.FluentSocketPath, defaultSocketPath) } func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) { @@ -303,8 +310,8 @@ func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) { return } defer f.Close() - assert.Equal(t, f.Config.FluentNetwork, network) - assert.Equal(t, f.Config.FluentSocketPath, socketFile) + assertEqual(t, f.Config.FluentNetwork, network) + assertEqual(t, f.Config.FluentSocketPath, socketFile) socketFile = "/tmp/fluent-logger-golang-xxx.sock" network = "unixxxx" @@ -324,13 +331,13 @@ func Test_New_itShouldUseUnixDomainSocketIfUnixSocketSpecified(t *testing.T) { func Test_New_itShouldUseConfigValuesFromArguments(t *testing.T) { f, _ := New(Config{FluentPort: 6666, FluentHost: "foobarhost"}) - assert.Equal(t, f.Config.FluentPort, 6666) - assert.Equal(t, f.Config.FluentHost, "foobarhost") + assertEqual(t, f.Config.FluentPort, 6666) + assertEqual(t, f.Config.FluentHost, "foobarhost") } func Test_New_itShouldUseConfigValuesFromMashalAsJSONArgument(t *testing.T) { f, _ := New(Config{MarshalAsJSON: true}) - assert.Equal(t, f.Config.MarshalAsJSON, true) + assertEqual(t, f.Config.MarshalAsJSON, true) } func Test_MarshalAsMsgpack(t *testing.T) { @@ -432,9 +439,7 @@ func TestJsonConfig(t *testing.T) { t.Error(err) } - if !reflect.DeepEqual(expect, got) { - t.Errorf("got %v, except %v", got, expect) - } + assertEqual(t, got, expect) } func TestPostWithTime(t *testing.T) { @@ -650,9 +655,9 @@ func TestNoPanicOnAsyncClose(t *testing.T) { } err = f.EncodeAndPostData("tag_name", time.Unix(1482493046, 0), map[string]string{"foo": "bar"}) if tc.shouldError { - assert.Equal(t, fmt.Errorf("fluent#appendBuffer: Logger already closed"), err) + assertEqual(t, err, fmt.Errorf("fluent#appendBuffer: Logger already closed")) } else { - assert.Equal(t, nil, err) + assertEqual(t, err, nil) } }) } @@ -760,10 +765,14 @@ func TestSyncWriteAfterCloseFails(t *testing.T) { err = f.PostWithTime("tag_name", time.Unix(1482493050, 0), map[string]string{"foo": "buzz"}) // The event submission must fail, - assert.NotEqual(t, err, nil) + if err == nil { + t.Error("expected an error") + } // and also must keep Fluentd closed. - assert.NotEqual(t, f.closed, false) + if f.closed != true { + t.Error("expected Fluentd to be kept closed") + } }() conn := d.waitForNextDialing(true, false) From fe4328217c06abfee9bf4c94c29791c11227bb9f Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Dec 2022 15:34:09 +0100 Subject: [PATCH 07/11] gha: update go versions to 1.19, 1.20, 1.21 Note that go1.13 has reached EOL a long time ago; removing that version, as packages are no longer compatible with it: go get github.com/philhofer/fwd # golang.org/x/tools/internal/gocommand Error: ../../../go/src/golang.org/x/tools/internal/gocommand/invoke.go:399:62: undefined: os.ErrProcessDone Error: Process completed with exit code 2. Signed-off-by: Sebastiaan van Stijn --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 38b2670..76fafbe 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu, macos, windows] - golang: ['1.13', '1.16', '1.17'] + golang: ['1.19', '1.20', '1.21'] # currently, we cannot run non-x86_64 machines on GitHub Actions cloud env. runs-on: ${{ matrix.os }}-latest name: CI golang ${{ matrix.golang }} on ${{ matrix.os }} From 714b11beb47b2e5b510a372a1d07d9dc41a28138 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 10 Dec 2022 15:38:29 +0100 Subject: [PATCH 08/11] add go.mod Signed-off-by: Sebastiaan van Stijn --- go.mod | 7 +++++++ go.sum | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..798ccb1 --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module github.com/fluent/fluent-logger-golang + +go 1.19 + +require github.com/tinylib/msgp v1.1.8 + +require github.com/philhofer/fwd v1.1.2 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..af94de9 --- /dev/null +++ b/go.sum @@ -0,0 +1,34 @@ +github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= +github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= +github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0= +github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From ce664d83ab27ca202ac4be5960e572e312d19748 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Jul 2023 16:14:02 +0200 Subject: [PATCH 09/11] gha: remove step to manually install dependencies the go module should take care of downloading the module. Signed-off-by: Sebastiaan van Stijn --- .github/workflows/ci.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 76fafbe..3b7cb2b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,11 +23,5 @@ jobs: - uses: actions/setup-go@v4 with: go-version: ${{ matrix.golang }} - - name: Change GO11MODULES - run: go env -w GO111MODULE=auto - - name: Install requirements - run: | - go get github.com/philhofer/fwd - go get github.com/tinylib/msgp - name: Test run: go test -v ./fluent From 152f59876e661110b2534430c024f409dab696ba Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Jul 2023 15:50:32 +0200 Subject: [PATCH 10/11] go generate update generated code with the latest version of msgp: go generate -x ./... Signed-off-by: Sebastiaan van Stijn --- fluent/proto_gen_test.go | 10 +++++----- fluent/test_message_gen_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fluent/proto_gen_test.go b/fluent/proto_gen_test.go index e0e45b2..3d35b60 100644 --- a/fluent/proto_gen_test.go +++ b/fluent/proto_gen_test.go @@ -74,7 +74,7 @@ func TestEncodeDecodeAckResp(t *testing.T) { m := v.Msgsize() if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) + t.Log("WARNING: TestEncodeDecodeAckResp Msgsize() is inaccurate") } vn := AckResp{} @@ -187,7 +187,7 @@ func TestEncodeDecodeEntry(t *testing.T) { m := v.Msgsize() if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) + t.Log("WARNING: TestEncodeDecodeEntry Msgsize() is inaccurate") } vn := Entry{} @@ -300,7 +300,7 @@ func TestEncodeDecodeForward(t *testing.T) { m := v.Msgsize() if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) + t.Log("WARNING: TestEncodeDecodeForward Msgsize() is inaccurate") } vn := Forward{} @@ -413,7 +413,7 @@ func TestEncodeDecodeMessage(t *testing.T) { m := v.Msgsize() if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) + t.Log("WARNING: TestEncodeDecodeMessage Msgsize() is inaccurate") } vn := Message{} @@ -526,7 +526,7 @@ func TestEncodeDecodeMessageExt(t *testing.T) { m := v.Msgsize() if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) + t.Log("WARNING: TestEncodeDecodeMessageExt Msgsize() is inaccurate") } vn := MessageExt{} diff --git a/fluent/test_message_gen_test.go b/fluent/test_message_gen_test.go index 86cb18d..27116a9 100644 --- a/fluent/test_message_gen_test.go +++ b/fluent/test_message_gen_test.go @@ -74,7 +74,7 @@ func TestEncodeDecodeTestMessage(t *testing.T) { m := v.Msgsize() if buf.Len() > m { - t.Logf("WARNING: Msgsize() for %v is inaccurate", v) + t.Log("WARNING: TestEncodeDecodeTestMessage Msgsize() is inaccurate") } vn := TestMessage{} From 3f4e90bd3d6b18d8e897a5f5e801948b0233646f Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Jul 2023 16:10:32 +0200 Subject: [PATCH 11/11] remove unused defaultSubSecondPrecision const Signed-off-by: Sebastiaan van Stijn --- fluent/fluent.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/fluent/fluent.go b/fluent/fluent.go index b00c3c6..c999348 100644 --- a/fluent/fluent.go +++ b/fluent/fluent.go @@ -33,9 +33,6 @@ const ( defaultMaxRetryWait = 60000 defaultMaxRetry = 13 defaultReconnectWaitIncreRate = 1.5 - // Default sub-second precision value to false since it is only compatible - // with fluentd versions v0.14 and above. - defaultSubSecondPrecision = false // Default value whether to skip checking insecure certs on TLS connections. defaultTlsInsecureSkipVerify = false