Skip to content

Commit

Permalink
[exporter/loadbalancingexporter] Enable gocritic (#11164)
Browse files Browse the repository at this point in the history
Signed-off-by: xin.li <xin.li@daocloud.io>
  • Loading branch information
my-git9 authored Jun 22, 2022
1 parent 6f4f082 commit c102c42
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions exporter/loadbalancingexporter/log_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:errcheck,gocritic
// nolint:errcheck
package loadbalancingexporter

import (
Expand Down Expand Up @@ -481,36 +481,36 @@ func simpleLogWithoutID() plog.Logs {

type mockLogsExporter struct {
component.Component
ConsumeLogsFn func(ctx context.Context, ld plog.Logs) error
consumelogsfn func(ctx context.Context, ld plog.Logs) error
}

func (e *mockLogsExporter) Capabilities() consumer.Capabilities {
return consumer.Capabilities{MutatesData: false}
}

func (e *mockLogsExporter) ConsumeLogs(ctx context.Context, ld plog.Logs) error {
if e.ConsumeLogsFn == nil {
if e.consumelogsfn == nil {
return nil
}
return e.ConsumeLogsFn(ctx, ld)
return e.consumelogsfn(ctx, ld)
}

type mockComponent struct {
component.StartFunc
component.ShutdownFunc
}

func newMockLogsExporter(ConsumeLogsFn func(ctx context.Context, ld plog.Logs) error) component.LogsExporter {
func newMockLogsExporter(consumelogsfn func(ctx context.Context, ld plog.Logs) error) component.LogsExporter {
return &mockLogsExporter{
Component: mockComponent{},
ConsumeLogsFn: ConsumeLogsFn,
consumelogsfn: consumelogsfn,
}
}

func newNopMockLogsExporter() component.LogsExporter {
return &mockLogsExporter{
Component: mockComponent{},
ConsumeLogsFn: func(ctx context.Context, ld plog.Logs) error {
consumelogsfn: func(ctx context.Context, ld plog.Logs) error {
return nil
},
}
Expand Down

0 comments on commit c102c42

Please sign in to comment.