👕 Remove getFieldsWithReadonlyTag method to fix the linter error

This commit is contained in:
M. Mert Yildiran 2022-12-28 23:20:05 +03:00
parent 86b1289c5d
commit 872e4961dd
No known key found for this signature in database
GPG Key ID: DA5D6DCBB758A461

View File

@ -1,25 +0,0 @@
package config_test
import (
"reflect"
"strings"
"github.com/kubeshark/kubeshark/config"
)
func getFieldsWithReadonlyTag(currentElem reflect.Value, readonlyFields *[]string) {
for i := 0; i < currentElem.NumField(); i++ {
currentField := currentElem.Type().Field(i)
currentFieldByName := currentElem.FieldByName(currentField.Name)
if currentField.Type.Kind() == reflect.Struct {
getFieldsWithReadonlyTag(currentFieldByName, readonlyFields)
continue
}
if _, ok := currentField.Tag.Lookup(config.ReadonlyTag); ok {
fieldNameByTag := strings.Split(currentField.Tag.Get(config.FieldNameTag), ",")[0]
*readonlyFields = append(*readonlyFields, fieldNameByTag)
}
}
}