go-libaudit icon indicating copy to clipboard operation
go-libaudit copied to clipboard

Check fieldalignment in golangci-lint

Open andrewkroh opened this issue 3 years ago • 3 comments

In #117 some alignment issues were fixed. This will help prevent future regressions.

andrewkroh avatar Jul 08 '22 18:07 andrewkroh

:green_heart: 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: 2022-07-14T20:09:00.656+0000

  • Duration: 2 min 13 sec

Test stats :test_tube:

Test Results
Failed 0
Passed 386
Skipped 40
Total 426

elasticmachine avatar Jul 08 '22 18:07 elasticmachine

On the basis of experiments that I did to see the performance impact of pointer byte count (essentially none) I'm having second thought about this.

efd6 avatar Jul 09 '22 21:07 efd6

As https://github.com/elastic/go-libaudit/pull/117 is neither approved nor merged, this change should report at least some unaligned structs. Also for auditRuleData I would expect a nolint instruction, as fieldalignment is not happy how the kernel orders the struct that is passed to user space and parsed. From a Go perspective []byte should be placed before auditRuleHeader but this will break parsing.

florianl avatar Jul 14 '22 10:07 florianl