这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@pjhades
Copy link
Contributor

@pjhades pjhades commented Dec 13, 2024

The varinit linter reports false negative results against global const blocks where constants are defined with iota - in that case constants after iota would have no initializer. This commit skips global const blocks entirely, because

  • if iota is used, constants are indeed initialized
  • constants not covered by iota and without an initializer will not compile

The varinit linter would report errors against global const blocks where
constants are defined with iota - in that case constants after iota
would have no initializer. This commit skips global const blocks
entirely, because

- if iota is used, constants are indeed initialized
- constants not covered by iota and without an initializer will not
  compile
@andrewbaxter
Copy link
Contributor

Thanks, this looks great! I guess that goes for all constants - you can't define constants without initializing so we don't need to check those in the first place.

@andrewbaxter andrewbaxter merged commit f25b7a2 into upsun:main Dec 14, 2024
@pjhades pjhades deleted the fix-varinit-const-iota branch December 15, 2024 18:27
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.

2 participants