diff options
| author | Shulhan <ms@kilabit.info> | 2026-04-05 03:50:32 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-04-05 03:52:47 +0700 |
| commit | 778fd16011ec1d39c41b62372dc65f045183266e (patch) | |
| tree | a6f6f26930c00d8ac3dd7bfa1fb476bd65454833 /lib/ini | |
| parent | 6fba7b9ce3bcaf4225e5ab774a15ef7364ed1420 (diff) | |
| download | pakakeh.go-778fd16011ec1d39c41b62372dc65f045183266e.tar.xz | |
all: apply go fix
Diffstat (limited to 'lib/ini')
| -rw-r--r-- | lib/ini/common_test.go | 3 | ||||
| -rw-r--r-- | lib/ini/ini.go | 14 | ||||
| -rw-r--r-- | lib/ini/ini_unmarshal.go | 10 | ||||
| -rw-r--r-- | lib/ini/struct_field.go | 8 | ||||
| -rw-r--r-- | lib/ini/tag_struct_field.go | 2 |
5 files changed, 18 insertions, 19 deletions
diff --git a/lib/ini/common_test.go b/lib/ini/common_test.go index c41de518..64190ce5 100644 --- a/lib/ini/common_test.go +++ b/lib/ini/common_test.go @@ -105,14 +105,13 @@ func TestParseTag_fromStruct(t *testing.T) { {`a`, `b ": c`, `d`, ``}, } - adt ADT vtype reflect.Type field reflect.StructField tag string got []string ) - vtype = reflect.TypeOf(adt) + vtype = reflect.TypeFor[ADT]() for x := range vtype.NumField() { field = vtype.Field(x) diff --git a/lib/ini/ini.go b/lib/ini/ini.go index a75ac0d2..419018d0 100644 --- a/lib/ini/ini.go +++ b/lib/ini/ini.go @@ -114,7 +114,7 @@ func Marshal(v any) (b []byte, err error) { rvalue := reflect.ValueOf(v) kind := rtipe.Kind() - for kind == reflect.Ptr { + for kind == reflect.Pointer { rtipe = rtipe.Elem() rvalue = rvalue.Elem() kind = rtipe.Kind() @@ -194,7 +194,7 @@ func (in *Ini) marshalStruct( } key = strings.ToLower(key) - for kind == reflect.Ptr { + for kind == reflect.Pointer { ftype = ftype.Elem() kind = ftype.Kind() fvalue = fvalue.Elem() @@ -209,7 +209,7 @@ func (in *Ini) marshalStruct( case reflect.Array, reflect.Slice: for xx := 0; xx < fvalue.Len(); xx++ { item := fvalue.Index(xx) - for item.Kind() == reflect.Ptr { + for item.Kind() == reflect.Pointer { item = item.Elem() } switch item.Kind() { @@ -255,7 +255,7 @@ func (in *Ini) marshalStruct( for _, key = range keys { mapValue = amap[key] valueType = reflect.TypeOf(mapValue.Interface()) - for valueType.Kind() == reflect.Ptr { + for valueType.Kind() == reflect.Pointer { valueType = valueType.Elem() mapValue = mapValue.Elem() } @@ -267,8 +267,8 @@ func (in *Ini) marshalStruct( } } - case reflect.Ptr: - for ftype.Kind() == reflect.Ptr { + case reflect.Pointer: + for ftype.Kind() == reflect.Pointer { ftype = ftype.Elem() fvalue = fvalue.Elem() } @@ -328,7 +328,7 @@ func (in *Ini) Unmarshal(v any) (err error) { rvalue := reflect.ValueOf(v) kind := rtipe.Kind() - for kind != reflect.Ptr { + for kind != reflect.Pointer { return fmt.Errorf("ini: Unmarshal: expecting pointer to struct, got %v", kind) } diff --git a/lib/ini/ini_unmarshal.go b/lib/ini/ini_unmarshal.go index aed1548e..b999c36c 100644 --- a/lib/ini/ini_unmarshal.go +++ b/lib/ini/ini_unmarshal.go @@ -46,8 +46,8 @@ func (in *Ini) unmarshal(tagField *tagStructField) { case reflect.Map: unmarshalToMap(sec, sfield.ftype, sfield.fval) - case reflect.Ptr: - for sfield.fkind == reflect.Ptr { + case reflect.Pointer: + for sfield.fkind == reflect.Pointer { sfield.ftype = sfield.ftype.Elem() sfield.fkind = sfield.ftype.Kind() } @@ -72,9 +72,9 @@ func (in *Ini) unmarshal(tagField *tagStructField) { newSlice := reflect.Append(sfield.fval, newStruct.Elem()) sfield.fval.Set(newSlice) - case reflect.Ptr: + case reflect.Pointer: // V []*T - for sliceElem.Kind() == reflect.Ptr { + for sliceElem.Kind() == reflect.Pointer { sliceElem = sliceElem.Elem() } @@ -127,7 +127,7 @@ func unmarshalToMap(sec *Section, rtype reflect.Type, rval reflect.Value) bool { } else { amap = rval } - for elKind == reflect.Ptr { + for elKind == reflect.Pointer { elType = elType.Elem() elKind = elType.Kind() isPtr = true diff --git a/lib/ini/struct_field.go b/lib/ini/struct_field.go index 0b4a1222..e31ed176 100644 --- a/lib/ini/struct_field.go +++ b/lib/ini/struct_field.go @@ -37,8 +37,8 @@ func (sfield *structField) set(val string) bool { return true } - case reflect.Ptr: - for sfield.fkind == reflect.Ptr { + case reflect.Pointer: + for sfield.fkind == reflect.Pointer { sfield.ftype = sfield.ftype.Elem() sfield.fkind = sfield.ftype.Kind() } @@ -96,8 +96,8 @@ func (sfield *structField) append(val string) (slice reflect.Value, ok bool) { slice = reflect.Append(slice, reflect.ValueOf(t)) } - case reflect.Ptr: - for ftype.Kind() == reflect.Ptr { + case reflect.Pointer: + for ftype.Kind() == reflect.Pointer { ftype = ftype.Elem() } diff --git a/lib/ini/tag_struct_field.go b/lib/ini/tag_struct_field.go index 672d5c97..8a6b42e0 100644 --- a/lib/ini/tag_struct_field.go +++ b/lib/ini/tag_struct_field.go @@ -53,7 +53,7 @@ func unpackTagStructField(rtype reflect.Type, rval reflect.Value) (out *tagStruc out.v[key] = sf } - case reflect.Ptr: + case reflect.Pointer: if fval.IsNil() { continue } |
