From b70c8ab9bc3225a5cbad746902e4252477500e7b Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 3 Aug 2024 18:00:40 +0700 Subject: lib/ini: mention that marshaling []byte does not supported Due to "byte" is considered as "uint8" during reflection, we cannot tell whether the value is slice of byte of slice of number with type uint8. --- lib/ini/doc.go | 2 ++ lib/ini/ini.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/ini/doc.go b/lib/ini/doc.go index d058f094..3c4bc4dd 100644 --- a/lib/ini/doc.go +++ b/lib/ini/doc.go @@ -139,6 +139,8 @@ A double quote is escaped using triple backslash, for example `\\\"`. If the field type is slice of primitive, for example "[]int", it will be marshaled into multiple key with the same name. +Note that, marshaling "[]byte" does not supported, due to ambiguity between +"byte" and "uint8" during reflection. If the field type is struct, it will marshaled as new section and/or subsection based on tag on the struct field diff --git a/lib/ini/ini.go b/lib/ini/ini.go index c233b892..7bab0039 100644 --- a/lib/ini/ini.go +++ b/lib/ini/ini.go @@ -104,6 +104,8 @@ func Parse(text []byte) (in *Ini, err error) { // field's name. // // An array or slice will be encoded as multiple keys. +// Marshaling "[]byte" does not supported, due to ambiguity between +// "byte" and "uint8" during reflection. // // One exception to above rule is map type. // A map's key will override the key defined in tag. -- cgit v1.3