Skip to content
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
varungandhi-src merged 1 commit into
mainfrom
vg/wip/exhaustruct
Jul 23, 2024
Merged

feat(build): Add exhaustruct linter (codeintel POC)#63965
varungandhi-src merged 1 commit into
mainfrom
vg/wip/exhaustruct

Conversation

@varungandhi-src

@varungandhi-src varungandhi-src commented Jul 20, 2024

Copy link
Copy Markdown
Contributor

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 exhaustiveness
checking, and Foo{bar} does check for exhaustiveness but can be less readable
depending 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

@cla-bot cla-bot Bot added the cla-signed label Jul 20, 2024
@github-actions github-actions Bot added team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) team/product-platform labels Jul 20, 2024
@varungandhi-src varungandhi-src requested a review from a team July 22, 2024 14:44
@varungandhi-src varungandhi-src changed the title feat(build): Add exhaustruct linter (POC) feat(build): Add exhaustruct linter (codeintel POC) Jul 22, 2024
@varungandhi-src varungandhi-src requested a review from burmudar July 23, 2024 09:21
@varungandhi-src varungandhi-src merged commit eeded69 into main Jul 23, 2024
@varungandhi-src varungandhi-src deleted the vg/wip/exhaustruct branch July 23, 2024 09:26
@keegancsmith

Copy link
Copy Markdown
Member

neat

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) team/product-platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants