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

Code cleanup: replace interface{} with any #903

Closed
chavacava opened this issue Sep 23, 2023 · 1 comment
Closed

Code cleanup: replace interface{} with any #903

chavacava opened this issue Sep 23, 2023 · 1 comment

Comments

@chavacava
Copy link
Collaborator

Go 1.18 introduced any as an alias for interface{}. Current revive's code base still uses interface{}.

Running revive over its own source code with the following configuration:

ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 0
warningCode = 0

[rule.use-any]

results in

test/error-strings-custom-functions_test.go:11:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/unhandled-error_test.go:15:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/var-naming_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/var-naming_test.go:12:30: since GO 1.18 'interface{}' can be replaced by 'any'
test/var-naming_test.go:12:51: since GO 1.18 'interface{}' can be replaced by 'any'
test/comment-spacings_test.go:13:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/argument-limit_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/early-return_test.go:14:91: since GO 1.18 'interface{}' can be replaced by 'any'
test/line-length-limit_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/max-public-structs_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/add-constant_test.go:11:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/file-header_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/exported_test.go:11:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/cyclomatic_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/unused-param_test.go:12:98: since GO 1.18 'interface{}' can be replaced by 'any'
test/enforce-map-style_test.go:16:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/struct-tag_test.go:17:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/unused-receiver_test.go:12:104: since GO 1.18 'interface{}' can be replaced by 'any'
test/context-as-argument_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/function-length_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/import-blacklist_test.go:11:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/banned-characters_test.go:15:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/cognitive-complexity_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/defer_test.go:17:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/enforce-slice-style_test.go:16:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:13:6: since GO 1.18 'interface{}' can be replaced by 'any'
test/superfluous-else_test.go:14:99: since GO 1.18 'interface{}' can be replaced by 'any'
test/function-result-limit_test.go:12:16: since GO 1.18 'interface{}' can be replaced by 'any'
lint/config.go:4:20: since GO 1.18 'interface{}' can be replaced by 'any'
lint/file.go:51:25: since GO 1.18 'interface{}' can be replaced by 'any'
test/var-naming_test.go:19:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/file-header_test.go:16:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/add-constant_test.go:11:35: since GO 1.18 'interface{}' can be replaced by 'any'
test/cyclomatic_test.go:15:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/exported_test.go:17:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/enforce-map-style_test.go:22:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/unused-param_test.go:13:14: since GO 1.18 'interface{}' can be replaced by 'any'
test/unused-receiver_test.go:13:14: since GO 1.18 'interface{}' can be replaced by 'any'
test/function-length_test.go:18:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/context-as-argument_test.go:13:15: since GO 1.18 'interface{}' can be replaced by 'any'
test/import-blacklist_test.go:19:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/defer_test.go:17:30: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:18:6: since GO 1.18 'interface{}' can be replaced by 'any'
test/enforce-slice-style_test.go:22:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/file-header_test.go:20:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/var-naming_test.go:19:30: since GO 1.18 'interface{}' can be replaced by 'any'
test/exported_test.go:23:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/function-length_test.go:24:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/defer_test.go:23:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/import-blacklist_test.go:27:12: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:21:6: since GO 1.18 'interface{}' can be replaced by 'any'
test/var-naming_test.go:19:47: since GO 1.18 'interface{}' can be replaced by 'any'
test/file-header_test.go:24:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/defer_test.go:23:30: since GO 1.18 'interface{}' can be replaced by 'any'
test/var-naming_test.go:19:64: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:25:6: since GO 1.18 'interface{}' can be replaced by 'any'
test/file-header_test.go:28:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:50:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/var-naming_test.go:19:87: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:56:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/file-header_test.go:32:16: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:62:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:69:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/file-header_test.go:40:17: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:76:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:83:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:90:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:92:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:94:7: since GO 1.18 'interface{}' can be replaced by 'any'
test/string-format_test.go:99:7: since GO 1.18 'interface{}' can be replaced by 'any'
rule/defer.go:59:23: since GO 1.18 'interface{}' can be replaced by 'any'
rule/string-format.go:41:17: since GO 1.18 'interface{}' can be replaced by 'any'
rule/string-format.go:104:54: since GO 1.18 'interface{}' can be replaced by 'any'
rule/string-format.go:105:23: since GO 1.18 'interface{}' can be replaced by 'any'
rule/unused-receiver.go:38:34: since GO 1.18 'interface{}' can be replaced by 'any'
rule/function-length.go:174:46: since GO 1.18 'interface{}' can be replaced by 'any'
rule/utils.go:161:14: since GO 1.18 'interface{}' can be replaced by 'any'
rule/var-naming.go:47:35: since GO 1.18 'interface{}' can be replaced by 'any'
rule/add-constant.go:182:41: since GO 1.18 'interface{}' can be replaced by 'any'
rule/context-as-argument.go:85:36: since GO 1.18 'interface{}' can be replaced by 'any'
rule/var-naming.go:54:38: since GO 1.18 'interface{}' can be replaced by 'any'
rule/var-naming.go:258:18: since GO 1.18 'interface{}' can be replaced by 'any'
rule/var-naming.go:259:21: since GO 1.18 'interface{}' can be replaced by 'any'
rule/unused-param.go:38:34: since GO 1.18 'interface{}' can be replaced by 'any'

References to interface{} shall be replaced by any and running revive with the above configuration shall return no issues.

@chavacava
Copy link
Collaborator Author

Closed by #906

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant