Skip to content

Commit

Permalink
[chore][receiver/windowseventlog] Fix lint on Windows (open-telemetry…
Browse files Browse the repository at this point in the history
…#30311)

**Description:**
Fixing lint issues when GOOS=windows. This is in preparation to
eventually include lint with GOOS=windows as part of CI.
  • Loading branch information
pjanotti authored and cparkins committed Jan 10, 2024
1 parent 2126d79 commit bb953a4
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions receiver/windowseventlogreceiver/receiver_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ func TestReadWindowsEventLogger(t *testing.T) {

err = receiver.Start(ctx, componenttest.NewNopHost())
require.NoError(t, err)
defer receiver.Shutdown(ctx)
defer func() {
require.NoError(t, receiver.Shutdown(ctx))
}()

src := "otel"
err = eventlog.InstallAsEventCreate(src, eventlog.Info|eventlog.Warning|eventlog.Error)
require.NoError(t, err)
defer eventlog.Remove(src)
defer func() {
require.NoError(t, eventlog.Remove(src))
}()

logger, err := eventlog.Open(src)
require.NoError(t, err)
Expand Down Expand Up @@ -144,11 +148,15 @@ func TestReadWindowsEventLoggerRaw(t *testing.T) {

err = receiver.Start(ctx, componenttest.NewNopHost())
require.NoError(t, err)
defer receiver.Shutdown(ctx)
defer func() {
require.NoError(t, receiver.Shutdown(ctx))
}()

src := "otel"
err = eventlog.InstallAsEventCreate(src, eventlog.Info|eventlog.Warning|eventlog.Error)
defer eventlog.Remove(src)
defer func() {
require.NoError(t, eventlog.Remove(src))
}()
require.NoError(t, err)

logger, err := eventlog.Open(src)
Expand Down Expand Up @@ -197,11 +205,15 @@ func TestReadWindowsEventLoggerWithExcludeProvider(t *testing.T) {

err = receiver.Start(ctx, componenttest.NewNopHost())
require.NoError(t, err)
defer receiver.Shutdown(ctx)
defer func() {
require.NoError(t, receiver.Shutdown(ctx))
}()

err = eventlog.InstallAsEventCreate(src, eventlog.Info|eventlog.Warning|eventlog.Error)
require.NoError(t, err)
defer eventlog.Remove(src)
defer func() {
require.NoError(t, eventlog.Remove(src))
}()

logger, err := eventlog.Open(src)
require.NoError(t, err)
Expand Down Expand Up @@ -237,10 +249,14 @@ func TestReadWindowsEventLoggerRawWithExcludeProvider(t *testing.T) {

err = receiver.Start(ctx, componenttest.NewNopHost())
require.NoError(t, err)
defer receiver.Shutdown(ctx)
defer func() {
require.NoError(t, receiver.Shutdown(ctx))
}()

err = eventlog.InstallAsEventCreate(src, eventlog.Info|eventlog.Warning|eventlog.Error)
defer eventlog.Remove(src)
defer func() {
require.NoError(t, eventlog.Remove(src))
}()
require.NoError(t, err)

logger, err := eventlog.Open(src)
Expand Down

0 comments on commit bb953a4

Please sign in to comment.