diff options
| author | Shulhan <ms@kilabit.info> | 2024-08-03 18:00:40 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-08-04 11:33:49 +0700 |
| commit | b70c8ab9bc3225a5cbad746902e4252477500e7b (patch) | |
| tree | 79648fb28bc755d5523ca5e282e5ef3ae56a5561 | |
| parent | 426f3df9aaf6d4788567da2f7ca17ce14cb56b38 (diff) | |
| download | pakakeh.go-b70c8ab9bc3225a5cbad746902e4252477500e7b.tar.xz | |
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.
| -rw-r--r-- | lib/ini/doc.go | 2 | ||||
| -rw-r--r-- | lib/ini/ini.go | 2 |
2 files changed, 4 insertions, 0 deletions
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. |
