Skip to content

Conversation

@alexandear
Copy link
Contributor

Change type

🆕 New feature or enhancement

Short description

Enable modernize linter and fix its issues.

Full description

This PR enables modernize lint issues in Golangci-lint config and fixes the following lint issues:

$ golangci-lint run --enable-only modernize
jsonutils_iface.go:25:21: any: interface{} can be replaced by any (modernize)
func WriteJSON(data interface{}) ([]byte, error) { return jsonutils.WriteJSON(data) }
                    ^
jsonutils_iface.go:30:34: any: interface{} can be replaced by any (modernize)
func ReadJSON(data []byte, value interface{}) error { return jsonutils.ReadJSON(data, value) }
                                 ^
jsonutils_iface.go:35:31: any: interface{} can be replaced by any (modernize)
func DynamicJSONToStruct(data interface{}, target interface{}) error {
                              ^
jsonutils_iface.go:49:26: any: interface{} can be replaced by any (modernize)
func ToDynamicJSON(value interface{}) interface{} {
                         ^
jsonutils_iface.go:50:10: any: interface{} can be replaced by any (modernize)
        var res interface{}
                ^
jsonutils_iface.go:65:35: any: interface{} can be replaced by any (modernize)
func FromDynamicJSON(data, target interface{}) error { return jsonutils.FromDynamicJSON(data, target) }
                                  ^
loading_iface.go:76:29: any: interface{} can be replaced by any (modernize)
func YAMLData(path string) (interface{}, error) {
                            ^
loading_iface_test.go:66:4: slicescontains: Loop can be simplified using slices.Contains (modernize)
                        for _, v := range myHeaders {
                        ^
typeutils_iface.go:12:18: any: interface{} can be replaced by any (modernize)
func IsZero(data interface{}) bool { return typeutils.IsZero(data) }
                 ^
yamlutils_iface.go:15:22: any: interface{} can be replaced by any (modernize)
func YAMLToJSON(data interface{}) (json.RawMessage, error) { return yamlutils.YAMLToJSON(data) }
                     ^
yamlutils_iface.go:20:35: any: interface{} can be replaced by any (modernize)
func BytesToYAMLDoc(data []byte) (interface{}, error) { return yamlutils.BytesToYAMLDoc(data) }
                                  ^
11 issues:
* modernize: 11

Checklist

  • I have signed all my commits with my name and email (see DCO. This does not require a PGP-signed commit
  • I have rebased and squashed my work, so only one commit remains
  • I have added tests to cover my changes.
  • I have properly enriched go doc comments in code.
  • I have properly documented any breaking change.

Signed-off-by: Oleksandr Redko <[email protected]>
@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.94%. Comparing base (48179bd) to head (78fd721).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   90.65%   90.94%   +0.29%     
==========================================
  Files          53       53              
  Lines        2986     2419     -567     
==========================================
- Hits         2707     2200     -507     
+ Misses        237      177      -60     
  Partials       42       42              
Flag Coverage Δ
oldstable-macos-latest 90.49% <100.00%> (+0.60%) ⬆️
oldstable-ubuntu-latest 90.49% <100.00%> (+0.60%) ⬆️
oldstable-windows-latest 90.94% <100.00%> (+0.29%) ⬆️
stable-macos-latest 90.49% <100.00%> (+0.60%) ⬆️
stable-ubuntu-latest 90.49% <100.00%> (+0.60%) ⬆️
stable-windows-latest 90.94% <100.00%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant