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

golangci-lint: enable more govet checks and address issues #5739

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

c4rlo
Copy link
Contributor

@c4rlo c4rlo commented Dec 20, 2024

It turns out that the govet (= go vet) linter has a few more tricks up its sleeve, you just need to enable them.

This find a couple of bugs in the tests which are also being fixed in this commit:

  1. The spire-server tests for BatchCreateFederatedBundle and friends were accidentally not including JWT keys in the bundle they were testing. This ended up only affecting assertions on log message fields.

    The fix for this engendered a bit of refactoring to enable access to the required JWT struct conversion function.

  2. The spire-server tests for the CA journal were almost failing in their attempt to list CA journals; it ended up working anyway because a conversion between different struct types happened to be unnecessary because gorm could work with either one due to matching struct field names.

It turns out that the 'govet' linter has a few more tricks up its
sleeve, you just need to enable them.

This find a couple of bugs in the tests which are also being fixed in
this commit:

1. The spire-server tests for BatchCreateFederatedBundle and friends
   were accidentally not including JWT keys in the bundle they were
   testing. This ended up only affecting assertions on log message
   fields, which are being fixed here.
   The fix for this engendered a bit of refactoring to enable access to
   the required JWT struct conversion function.
2. The spire-server tests for the CA journal were _almost_ failing in
   their attempt to list CA journals; it ended up working anyway because
   a conversion between different struct types happened to be
   unnecessary because gorm could work with either one due to matching
   struct field names.

Signed-off-by: Carlo Teubner <[email protected]>
@c4rlo c4rlo changed the title Enable more govet checks and address issues golangci-lint: enable more govet checks and address issues Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant