Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix linter findings for Windows (part1) #13057

Merged
merged 11 commits into from
Apr 25, 2023
Merged

chore: Fix linter findings for Windows (part1) #13057

merged 11 commits into from
Apr 25, 2023

Conversation

zak-pawel
Copy link
Collaborator

It is only part of the bigger job: #13036
After all findings in whole project are handled for Windows, linter CI job for Windows can be enabled.

Fixes for following linters have been made:

  • dogsled
  • errcheck
  • errname
  • errorlint
  • gosimple

Following findings were addressed:

plugins/inputs/execd/execd_windows.go:22:28                                    errcheck   Error return value of `osStdin.SetWriteDeadline` is not checked
plugins/inputs/execd/execd_windows.go:25:52                                    errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/execd/shim/goshim_windows.go:16:3                               gosimple   S1000: should use a simple channel send/receive instead of `select` with a single case
plugins/inputs/ping/ping_windows.go:37:38                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ping/ping_windows.go:39:38                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ping/ping_windows_test.go:121:17                                errcheck   Error return value of `acc.GatherError` is not checked
plugins/inputs/ping/ping_windows_test.go:179:17                                errcheck   Error return value of `acc.GatherError` is not checked
plugins/inputs/ping/ping_windows_test.go:240:17                                errcheck   Error return value of `acc.GatherError` is not checked
plugins/inputs/ping/ping_windows_test.go:286:17                                errcheck   Error return value of `acc.GatherError` is not checked
plugins/inputs/ping/ping_windows_test.go:334:17                                errcheck   Error return value of `acc.GatherError` is not checked
plugins/inputs/ping/ping_windows_test.go:368:17                                errcheck   Error return value of `acc.GatherError` is not checked
plugins/inputs/ping/ping_windows_test.go:76:17                                 errcheck   Error return value of `acc.GatherError` is not checked
plugins/inputs/procstat/win_service_windows.go:17:20                           errcheck   Error return value of `m.Disconnect` is not checked
plugins/inputs/procstat/win_service_windows.go:37:108                          errorlint  comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/win_eventlog/util.go:100:6                                      errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/win_eventlog/util.go:52:27                                      errcheck   Error return value of `windows.CloseHandle` is not checked
plugins/inputs/win_eventlog/win_eventlog.go:123:7                              errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/win_eventlog/win_eventlog.go:302:27                             errcheck   Error return value of `windows.CloseHandle` is not checked
plugins/inputs/win_eventlog/win_eventlog.go:336:6                              errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/win_eventlog/win_eventlog.go:431:17                             errcheck   Error return value is not checked
plugins/inputs/win_eventlog/win_eventlog.go:496:19                             errorlint  comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/win_perf_counters/win_perf_counters.go:385:19                   errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/win_perf_counters/win_perf_counters.go:469:92                   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/win_perf_counters/win_perf_counters.go:485:92                   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/win_perf_counters/win_perf_counters.go:558:19                   errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/win_perf_counters/win_perf_counters_integration_test.go:110:19  errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/win_perf_counters/win_perf_counters_test.go:34:2                dogsled    declaration has 4 blank identifiers
plugins/inputs/win_perf_counters/win_perf_counters_test.go:74:13               gosimple   S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
plugins/inputs/win_services/win_services.go:122:59                             errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/win_services/win_services.go:124:24                             errcheck   Error return value of `scmgr.Disconnect` is not checked
plugins/inputs/win_services/win_services.go:164:57                             errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/win_services/win_services.go:22:6                               errname    the type name `ServiceErr` should conform to the `XxxError` format
plugins/inputs/win_services/win_services.go:33:16                              errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/win_services/win_services_integration_test.go:23:24             errcheck   Error return value of `scmgr.Disconnect` is not checked
plugins/inputs/win_services/win_services_integration_test.go:28:18             errcheck   Error return value of `winServices.Init` is not checked
plugins/inputs/win_services/win_services_integration_test.go:43:24             errcheck   Error return value of `scmgr.Disconnect` is not checked
plugins/inputs/win_services/win_services_integration_test.go:48:18             errcheck   Error return value of `winServices.Init` is not checked
plugins/inputs/win_services/win_services_integration_test.go:63:9              errcheck   Error return value of `ws.Init` is not checked
plugins/inputs/win_services/win_services_test.go:158:18                        errcheck   Error return value of `winServices.Init` is not checked
plugins/inputs/win_services/win_services_test.go:173:18                        errcheck   Error return value of `winServices.Init` is not checked
plugins/inputs/win_services/win_services_test.go:201:18                        errcheck   Error return value of `winServices.Init` is not checked
plugins/inputs/win_services/win_services_test.go:223:18                        errcheck   Error return value of `winServices.Init` is not checked
plugins/inputs/win_wmi/win_wmi.go:113:14                                       errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/win_wmi/win_wmi.go:141:24                                       errcheck   Error return value of `serviceRaw.Clear` is not checked
plugins/inputs/win_wmi/win_wmi.go:149:23                                       errcheck   Error return value of `resultRaw.Clear` is not checked
plugins/inputs/win_wmi/win_wmi.go:171:20                                       errcheck   Error return value of `prop.Clear` is not checked
plugins/inputs/win_wmi/win_wmi.go:50:15                                        errcheck   Error return value of `v.Clear` is not checked
plugins/inputs/win_wmi/win_wmi_test.go:71:13                                   errcheck   Error return value of `plugin.Init` is not checked

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look at those issues @zak-pawel! I do have some comments.

plugins/inputs/execd/execd_windows.go Outdated Show resolved Hide resolved
plugins/inputs/execd/shim/goshim_windows.go Outdated Show resolved Hide resolved
plugins/inputs/ping/ping_windows_test.go Outdated Show resolved Hide resolved
plugins/inputs/win_eventlog/util.go Outdated Show resolved Hide resolved
plugins/inputs/win_perf_counters/win_perf_counters_test.go Outdated Show resolved Hide resolved
plugins/inputs/win_services/win_services.go Outdated Show resolved Hide resolved
plugins/inputs/win_wmi/win_wmi_test.go Outdated Show resolved Hide resolved
@srebhan srebhan self-assigned this Apr 11, 2023
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing all those nasty issues @zak-pawel!

@srebhan srebhan assigned powersj and unassigned srebhan Apr 14, 2023
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Apr 14, 2023
@telegraf-tiger
Copy link
Contributor

@zak-pawel
Copy link
Collaborator Author

@powersj Ping :)

Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I thought I had gone through this and sure enough I opened it up to "11 / 16 files viewed"

@powersj powersj merged commit 77ee21f into influxdata:master Apr 25, 2023
powersj pushed a commit that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore linter platform/windows ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants