[chore]: Bump codeberg.org/gruf/go-kv from 1.6.0 to 1.6.1 (#1619)

Bumps codeberg.org/gruf/go-kv from 1.6.0 to 1.6.1.

---
updated-dependencies:
- dependency-name: codeberg.org/gruf/go-kv
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-03-13 07:52:13 +00:00 committed by GitHub
parent 6e10175229
commit 0a864623f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 11 deletions

2
go.mod
View file

@ -9,7 +9,7 @@ require (
codeberg.org/gruf/go-debug v1.3.0 codeberg.org/gruf/go-debug v1.3.0
codeberg.org/gruf/go-errors/v2 v2.1.1 codeberg.org/gruf/go-errors/v2 v2.1.1
codeberg.org/gruf/go-fastcopy v1.1.2 codeberg.org/gruf/go-fastcopy v1.1.2
codeberg.org/gruf/go-kv v1.6.0 codeberg.org/gruf/go-kv v1.6.1
codeberg.org/gruf/go-logger/v2 v2.2.1 codeberg.org/gruf/go-logger/v2 v2.2.1
codeberg.org/gruf/go-mutexes v1.1.5 codeberg.org/gruf/go-mutexes v1.1.5
codeberg.org/gruf/go-runners v1.6.0 codeberg.org/gruf/go-runners v1.6.0

4
go.sum
View file

@ -67,8 +67,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-hashenc v1.0.2/go.mod h1:eK+A8clLcEN/m1nftNsRId0kfYDQnETnuIfBGZ8Gvsg=
codeberg.org/gruf/go-iotools v0.0.0-20221224124424-3386841cb225 h1:tP9YvEBfADGG3mXkfrALLadlcbrZsFsWKZvFtUZtrt8= codeberg.org/gruf/go-iotools v0.0.0-20221224124424-3386841cb225 h1:tP9YvEBfADGG3mXkfrALLadlcbrZsFsWKZvFtUZtrt8=
codeberg.org/gruf/go-iotools v0.0.0-20221224124424-3386841cb225/go.mod h1:B8uq4yHtIcKXhBZT9C/SYisz25lldLHMVpwZPz4ADLQ= codeberg.org/gruf/go-iotools v0.0.0-20221224124424-3386841cb225/go.mod h1:B8uq4yHtIcKXhBZT9C/SYisz25lldLHMVpwZPz4ADLQ=
codeberg.org/gruf/go-kv v1.6.0 h1:mCsERVt1Izsb0ZB7r7y/I6J/5sQhuL2Gmh/SqHWBJUY= codeberg.org/gruf/go-kv v1.6.1 h1:HsCZEy0zfGq1oFGOEOO2qnpooiGefCZBbcUpa3KdXn8=
codeberg.org/gruf/go-kv v1.6.0/go.mod h1:O/YkSvKiS9XsRolM3rqCd9YJmND7dAXu9z+PrlYO4bc= codeberg.org/gruf/go-kv v1.6.1/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 h1:RP2u059EQKTBFV3cN8X6xDxNk2RkzqdgXGKflKqB7Oc=
codeberg.org/gruf/go-logger/v2 v2.2.1/go.mod h1:m/vBfG5jNUmYXI8Hg9aVSk7Pn8YgEBITQB/B/CzdRss= 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= codeberg.org/gruf/go-mangler v1.2.3 h1:sj0dey2lF5GRQL7fXmCY0wPNaI5JrROiThb0VDbzF8A=

View file

@ -75,7 +75,7 @@ type Field struct {
// Key returns the formatted key string of this Field. // Key returns the formatted key string of this Field.
func (f Field) Key() string { func (f Field) Key() string {
buf := byteutil.Buffer{B: make([]byte, 0, bufsize/2)} buf := byteutil.Buffer{B: make([]byte, 0, bufsize/2)}
AppendQuote(&buf, f.K) AppendQuoteString(&buf, f.K)
return buf.String() return buf.String()
} }

View file

@ -25,7 +25,7 @@ func (f Field) AppendFormat(buf *byteutil.Buffer, vbose bool) {
} else /* regular */ { } else /* regular */ {
fmtstr = `%+v` fmtstr = `%+v`
} }
AppendQuote(buf, f.K) AppendQuoteString(buf, f.K)
buf.WriteByte('=') buf.WriteByte('=')
appendValuef(buf, fmtstr, f.V) appendValuef(buf, fmtstr, f.V)
} }
@ -50,7 +50,7 @@ func appendValuef(buf *byteutil.Buffer, format string, args ...interface{}) {
fmtbuf.B = fmt.Appendf(fmtbuf.B, format, args...) fmtbuf.B = fmt.Appendf(fmtbuf.B, format, args...)
// Append quoted value to dst buffer // Append quoted value to dst buffer
AppendQuote(buf, fmtbuf.String()) AppendQuoteValue(buf, fmtbuf.String())
// Drop overly large capacity buffers // Drop overly large capacity buffers
if fmtbuf.Cap() > int(^uint16(0)) { if fmtbuf.Cap() > int(^uint16(0)) {

View file

@ -16,7 +16,7 @@ func (f Field) AppendFormat(buf *byteutil.Buffer, vbose bool) {
} else /* regular */ { } else /* regular */ {
fmtstr = "{:v}" fmtstr = "{:v}"
} }
AppendQuote(buf, f.K) AppendQuoteString(buf, f.K)
buf.WriteByte('=') buf.WriteByte('=')
format.Appendf(buf, fmtstr, f.V) format.Appendf(buf, fmtstr, f.V)
} }

View file

@ -8,8 +8,8 @@ import (
"codeberg.org/gruf/go-kv/format" "codeberg.org/gruf/go-kv/format"
) )
// AppendQuote will append (and escape/quote where necessary) a formatted field string. // AppendQuoteString will append (and escape/quote where necessary) a field string.
func AppendQuote(buf *byteutil.Buffer, str string) { func AppendQuoteString(buf *byteutil.Buffer, str string) {
switch { switch {
case len(str) == 0: case len(str) == 0:
// Append empty quotes. // Append empty quotes.
@ -27,7 +27,52 @@ func AppendQuote(buf *byteutil.Buffer, str string) {
return return
case !isQuoted(str): case !isQuoted(str):
// Single/double quoted already. // Not single/double quoted already.
if format.ContainsSpaceOrTab(str) {
// Quote un-enclosed spaces.
buf.B = append(buf.B, '"')
buf.B = append(buf.B, str...)
buf.B = append(buf.B, '"')
return
}
if format.ContainsDoubleQuote(str) {
// Contains double quote, double quote
// and append escaped existing.
buf.B = append(buf.B, '"')
buf.B = format.AppendEscape(buf.B, str)
buf.B = append(buf.B, '"')
return
}
}
// Double quoted, enclosed in braces, or
// literally anything else: append as-is.
buf.B = append(buf.B, str...)
return
}
// AppendQuoteValue will append (and escape/quote where necessary) a formatted value string.
func AppendQuoteValue(buf *byteutil.Buffer, str string) {
switch {
case len(str) == 0:
// Append empty quotes.
buf.B = append(buf.B, `""`...)
return
case len(str) == 1:
// Append quote single byte.
appendQuoteByte(buf, str[0])
return
case len(str) > format.SingleTermLine || !format.IsSafeASCII(str):
// Long line or contains non-ascii chars.
buf.B = strconv.AppendQuote(buf.B, str)
return
case !isQuoted(str):
// Not single/double quoted already.
// Get space / tab indices (if any). // Get space / tab indices (if any).
s := strings.IndexByte(str, ' ') s := strings.IndexByte(str, ' ')

2
vendor/modules.txt vendored
View file

@ -39,7 +39,7 @@ codeberg.org/gruf/go-hashenc
# codeberg.org/gruf/go-iotools v0.0.0-20221224124424-3386841cb225 # codeberg.org/gruf/go-iotools v0.0.0-20221224124424-3386841cb225
## explicit; go 1.19 ## explicit; go 1.19
codeberg.org/gruf/go-iotools codeberg.org/gruf/go-iotools
# codeberg.org/gruf/go-kv v1.6.0 # codeberg.org/gruf/go-kv v1.6.1
## explicit; go 1.19 ## explicit; go 1.19
codeberg.org/gruf/go-kv codeberg.org/gruf/go-kv
codeberg.org/gruf/go-kv/format codeberg.org/gruf/go-kv/format