diff --git a/go.mod b/go.mod index 4472f0759..a37fc3066 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( codeberg.org/gruf/go-errors/v2 v2.2.0 codeberg.org/gruf/go-fastcopy v1.1.2 codeberg.org/gruf/go-iotools v0.0.0-20230601182242-d933b07dcbef - codeberg.org/gruf/go-kv v1.6.3 + codeberg.org/gruf/go-kv v1.6.4 codeberg.org/gruf/go-logger/v2 v2.2.1 codeberg.org/gruf/go-mutexes v1.1.5 codeberg.org/gruf/go-runners v1.6.1 diff --git a/go.sum b/go.sum index a875c504b..bffac9d10 100644 --- a/go.sum +++ b/go.sum @@ -66,8 +66,8 @@ codeberg.org/gruf/go-hashenc v1.0.2 h1:U3jH6zMXZiL96czD/qaJd8OR2h7LlBzGv/2WxnMHI codeberg.org/gruf/go-hashenc v1.0.2/go.mod h1:eK+A8clLcEN/m1nftNsRId0kfYDQnETnuIfBGZ8Gvsg= codeberg.org/gruf/go-iotools v0.0.0-20230601182242-d933b07dcbef h1:3Ydviw47TFEk27FRCOXkRxU3MfgyNzoicLzq8J3NbtI= codeberg.org/gruf/go-iotools v0.0.0-20230601182242-d933b07dcbef/go.mod h1:B8uq4yHtIcKXhBZT9C/SYisz25lldLHMVpwZPz4ADLQ= -codeberg.org/gruf/go-kv v1.6.3 h1:RrAhVGzAq+kU3WPR0gl1gqKnYks+prpUpa8+xDzoQXA= -codeberg.org/gruf/go-kv v1.6.3/go.mod h1:O/YkSvKiS9XsRolM3rqCd9YJmND7dAXu9z+PrlYO4bc= +codeberg.org/gruf/go-kv v1.6.4 h1:3NZiW8HVdBM3kpOiLb7XfRiihnzZWMAixdCznguhILk= +codeberg.org/gruf/go-kv v1.6.4/go.mod h1:O/YkSvKiS9XsRolM3rqCd9YJmND7dAXu9z+PrlYO4bc= codeberg.org/gruf/go-logger/v2 v2.2.1 h1:RP2u059EQKTBFV3cN8X6xDxNk2RkzqdgXGKflKqB7Oc= codeberg.org/gruf/go-logger/v2 v2.2.1/go.mod h1:m/vBfG5jNUmYXI8Hg9aVSk7Pn8YgEBITQB/B/CzdRss= codeberg.org/gruf/go-mangler v1.2.3 h1:sj0dey2lF5GRQL7fXmCY0wPNaI5JrROiThb0VDbzF8A= diff --git a/vendor/codeberg.org/gruf/go-kv/format/util.go b/vendor/codeberg.org/gruf/go-kv/format/util.go index f36727679..79cb30981 100644 --- a/vendor/codeberg.org/gruf/go-kv/format/util.go +++ b/vendor/codeberg.org/gruf/go-kv/format/util.go @@ -80,7 +80,7 @@ func Byte2Str(c byte) string { return `\t` case '\v': return `\v` - case '\'': + case '\\': return `\\` default: if c < ' ' { diff --git a/vendor/codeberg.org/gruf/go-kv/util.go b/vendor/codeberg.org/gruf/go-kv/util.go index ebcd3e304..c0c8ccdab 100644 --- a/vendor/codeberg.org/gruf/go-kv/util.go +++ b/vendor/codeberg.org/gruf/go-kv/util.go @@ -18,7 +18,9 @@ func AppendQuoteString(buf *byteutil.Buffer, str string) { case len(str) == 1: // Append quote single byte. - appendQuoteByte(buf, str[0]) + buf.B = append(buf.B, '\'') + buf.B = append(buf.B, format.Byte2Str(str[0])...) + buf.B = append(buf.B, '\'') return case len(str) > format.SingleTermLine || !format.IsSafeASCII(str): @@ -63,7 +65,9 @@ func AppendQuoteValue(buf *byteutil.Buffer, str string) { case len(str) == 1: // Append quote single byte. - appendQuoteByte(buf, str[0]) + buf.B = append(buf.B, '\'') + buf.B = append(buf.B, format.Byte2Str(str[0])...) + buf.B = append(buf.B, '\'') return case len(str) > format.SingleTermLine || !format.IsSafeASCII(str): @@ -115,35 +119,6 @@ func AppendQuoteValue(buf *byteutil.Buffer, str string) { return } -// appendEscapeByte will append byte to buffer, quoting and escaping where necessary. -func appendQuoteByte(buf *byteutil.Buffer, c byte) { - switch c { - // Double quote space. - case ' ': - buf.B = append(buf.B, '"', c, '"') - - // Escape + double quote. - case '\a': - buf.B = append(buf.B, '"', '\\', 'a', '"') - case '\b': - buf.B = append(buf.B, '"', '\\', 'b', '"') - case '\f': - buf.B = append(buf.B, '"', '\\', 'f', '"') - case '\n': - buf.B = append(buf.B, '"', '\\', 'n', '"') - case '\r': - buf.B = append(buf.B, '"', '\\', 'r', '"') - case '\t': - buf.B = append(buf.B, '"', '\\', 't', '"') - case '\v': - buf.B = append(buf.B, '"', '\\', 'v', '"') - - // Append as-is. - default: - buf.B = append(buf.B, c) - } -} - // isQuoted checks if string is single or double quoted. func isQuoted(str string) bool { return (str[0] == '"' && str[len(str)-1] == '"') || diff --git a/vendor/modules.txt b/vendor/modules.txt index 0cff8e5f8..7bb20f6a5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -40,7 +40,7 @@ codeberg.org/gruf/go-hashenc # codeberg.org/gruf/go-iotools v0.0.0-20230601182242-d933b07dcbef ## explicit; go 1.19 codeberg.org/gruf/go-iotools -# codeberg.org/gruf/go-kv v1.6.3 +# codeberg.org/gruf/go-kv v1.6.4 ## explicit; go 1.19 codeberg.org/gruf/go-kv codeberg.org/gruf/go-kv/format