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

winlogbeat/sys/winevent: use reflect IsZero method #29190

Merged
merged 1 commit into from
Nov 30, 2021
Merged

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Nov 30, 2021

What does this PR do?

Replace logic required to check whether a value is zero with the standard library method.

Why is it important?

Reduces line count. The previous logic was needed as it was added prior to the reflect IsZero method's addition, but now it is not.

Checklist

  • My code follows the style guidelines of this project
    - [ ] I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

No specific checks.

How to test this PR locally

Run go test in github.com/elastic/beats/v7/winlogbeat/sys/winevent.

Related issues

N/A

Use cases

Screenshots

N/A

Logs

N/A

@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Nov 30, 2021
Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM. Nice bit of code reduction. I think that code predated the existence of IsZero.

@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 30, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-11-30T08:53:17.411+0000

  • Duration: 105 min 16 sec

  • Commit: 5629501

Test stats 🧪

Test Results
Failed 0
Passed 41411
Skipped 4270
Total 45681

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@efd6
Copy link
Contributor Author

efd6 commented Nov 30, 2021

Yeah. I checked that, I think by a couple of years. I would have preferred to just do return i == nil || reflect.ValueOf(i).IsZero(), but that would change the behaviour for cases with a zero time.Time.

@efd6 efd6 merged commit 180e7f3 into elastic:master Nov 30, 2021
@efd6 efd6 deleted the winzero branch November 30, 2021 11:04
mergify bot pushed a commit that referenced this pull request Nov 30, 2021
efd6 added a commit that referenced this pull request Nov 30, 2021
elasticmachine pushed a commit to nxei/beats that referenced this pull request Dec 1, 2021
* upstream/master:
  [libbeat] Fix add_labels flattening of arrays values (elastic#29211)
  Change elastic-agent pprof default to false (elastic#29155)
  elastic#28472 fix flaky tests in libbeat fmtstr to use time.UTC instead of time.Local (elastic#28473)
  Adopt `parsers` in Filebeat's journald input (elastic#29070)
  [Elastic Agent] Add process error handling guidelines (elastic#29152)
  winlogbeat/sys/winevent: use reflect IsZero method (elastic#29190)
  Remove Journalbeat (elastic#29131)
  Add note that there is no warranty or support for generator code (elastic#28797)
  packetbeat: preparation for npcap addition (elastic#29017)
  Use the generic helper for opening file to read in filestream (elastic#29180)
  Workflow for macos (elastic#29174)
  Fix `decode_json_fields` processor to always add error key (elastic#29107)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.1-candidate backport-v8.0.0 Automated backport with mergify cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants