This repository was archived by the owner on Sep 30, 2024. It is now read-only.
feat(build): Add exhaustruct linter (codeintel POC)#63965
Merged
Conversation
burmudar
approved these changes
Jul 23, 2024
Member
|
neat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For certain types, we do not want the zero-value initialization for structs.
This means we need to trade off readability vs exhaustive initialization checking,
as the Go syntax
Foo{Bar: bar}is more readable, but doesn't do exhaustivenesschecking, and
Foo{bar}does check for exhaustiveness but can be less readabledepending on context.
For now, the check is only introduced for one type, and is meant to be opt-in
so that code authors may choose stricter checking.
Test plan
This should trigger some build failures first, I'll fix those by addressing the lint.
EDIT: This is not triggering build failures because test files are ignored by default,
https://sourcegraph.slack.com/archives/C04MYFW01NV/p1721631774299489?thread_ts=1721611178.332129&cid=C04MYFW01NV