You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In much of the go codebase, we use and initialize structs.
In most of those places, we should really ensure that all fields on the struct are explicitly initialized. This helps to ensure that new fields on structs aren't just silently getting the zero value for that type without anyone noticing.
We can annotate each struct initialization with:
// lint:require-exhaustive-initialization
To ensure that structs are exhaustively initialized.
But, that's just in the linter test. We want to start adopting this in more places in our codebase with the eventual goal of making the linter-opt out once the majority of struct initializations are exhaustive.
If you open a PR to add this annotation to a struct, be sure to reference this issue in the commit comment.
The text was updated successfully, but these errors were encountered:
In much of the go codebase, we use and initialize structs.
In most of those places, we should really ensure that all fields on the struct are explicitly initialized. This helps to ensure that new fields on structs aren't just silently getting the zero value for that type without anyone noticing.
We can annotate each struct initialization with:
To ensure that structs are exhaustively initialized.
One example of this is:
nitro/linters/testdata/src/structinit/a/a.go
Line 5 in 7fd92fa
But, that's just in the linter test. We want to start adopting this in more places in our codebase with the eventual goal of making the linter-opt out once the majority of struct initializations are exhaustive.
If you open a PR to add this annotation to a struct, be sure to reference this issue in the commit comment.
The text was updated successfully, but these errors were encountered: