fix(deps): update module github.com/go-logfmt/logfmt to v0.6.1 (main) (#19412)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2025-10-08 00:07:24 +00:00
committed by GitHub
parent 81acdef26e
commit 7f3d41930a
6 changed files with 31 additions and 21 deletions

2
go.mod
View File

@@ -41,7 +41,7 @@ require (
github.com/fluent/fluent-bit-go v0.0.0-20230731091245-a7a013e2473c
github.com/fsouza/fake-gcs-server v1.52.3
github.com/go-kit/log v0.2.1
github.com/go-logfmt/logfmt v0.6.0
github.com/go-logfmt/logfmt v0.6.1
github.com/gocql/gocql v1.7.0
github.com/gogo/protobuf v1.3.2 // remember to update loki-build-image/Dockerfile too
github.com/gogo/status v1.1.1

4
go.sum
View File

@@ -486,8 +486,8 @@ github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE=
github.com/go-logfmt/logfmt v0.6.1/go.mod h1:EV2pOAQoZaT1ZXZbqDl5hrymndi4SY9ED9/z6CO0XAk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=

View File

@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.6.1] - 2025-10-05
### Fixed
- Encode DEL (0x7f) control character by [@spaceone]
- Modernize code through Go 1.21 by [@ChrisHines]
[0.6.1]: https://github.com/go-logfmt/logfmt/compare/v0.6.0...v0.6.1
## [0.6.0] - 2023-01-30
[0.6.0]: https://github.com/go-logfmt/logfmt/compare/v0.5.1...v0.6.0
@@ -80,3 +89,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[@judwhite]: https://github.com/judwhite
[@nussjustin]: https://github.com/nussjustin
[@alexanderjophus]: https://github.com/alexanderjophus
[@spaceone]: https://github.com/spaceone

View File

@@ -13,7 +13,7 @@ import (
// MarshalKeyvals returns the logfmt encoding of keyvals, a variadic sequence
// of alternating keys and values.
func MarshalKeyvals(keyvals ...interface{}) ([]byte, error) {
func MarshalKeyvals(keyvals ...any) ([]byte, error) {
buf := &bytes.Buffer{}
if err := NewEncoder(buf).EncodeKeyvals(keyvals...); err != nil {
return nil, err
@@ -45,7 +45,7 @@ var (
// EncodeKeyval writes the logfmt encoding of key and value to the stream. A
// single space is written before the second and subsequent keys in a record.
// Nothing is written if a non-nil error is returned.
func (enc *Encoder) EncodeKeyval(key, value interface{}) error {
func (enc *Encoder) EncodeKeyval(key, value any) error {
enc.scratch.Reset()
if enc.needSep {
if _, err := enc.scratch.Write(space); err != nil {
@@ -72,7 +72,7 @@ func (enc *Encoder) EncodeKeyval(key, value interface{}) error {
// unsupported type or that cause a MarshalerError are replaced by their error
// but do not cause EncodeKeyvals to return an error. If a non-nil error is
// returned some key/value pairs may not have be written.
func (enc *Encoder) EncodeKeyvals(keyvals ...interface{}) error {
func (enc *Encoder) EncodeKeyvals(keyvals ...any) error {
if len(keyvals) == 0 {
return nil
}
@@ -122,7 +122,7 @@ var ErrUnsupportedKeyType = errors.New("unsupported key type")
// unsupported type.
var ErrUnsupportedValueType = errors.New("unsupported value type")
func writeKey(w io.Writer, key interface{}) error {
func writeKey(w io.Writer, key any) error {
if key == nil {
return ErrNilKey
}
@@ -155,7 +155,7 @@ func writeKey(w io.Writer, key interface{}) error {
switch rkey.Kind() {
case reflect.Array, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Struct:
return ErrUnsupportedKeyType
case reflect.Ptr:
case reflect.Pointer:
if rkey.IsNil() {
return ErrNilKey
}
@@ -170,7 +170,7 @@ func writeKey(w io.Writer, key interface{}) error {
// functions it causes them to remove invalid key runes from strings or byte
// slices respectively.
func keyRuneFilter(r rune) rune {
if r <= ' ' || r == '=' || r == '"' || r == utf8.RuneError {
if r <= ' ' || r == '=' || r == '"' || r == 0x7f || r == utf8.RuneError {
return -1
}
return r
@@ -194,7 +194,7 @@ func writeBytesKey(w io.Writer, key []byte) error {
return err
}
func writeValue(w io.Writer, value interface{}) error {
func writeValue(w io.Writer, value any) error {
switch v := value.(type) {
case nil:
return writeBytesValue(w, null)
@@ -222,7 +222,7 @@ func writeValue(w io.Writer, value interface{}) error {
switch rvalue.Kind() {
case reflect.Array, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Struct:
return ErrUnsupportedValueType
case reflect.Ptr:
case reflect.Pointer:
if rvalue.IsNil() {
return writeBytesValue(w, null)
}
@@ -233,7 +233,7 @@ func writeValue(w io.Writer, value interface{}) error {
}
func needsQuotedValueRune(r rune) bool {
return r <= ' ' || r == '=' || r == '"' || r == utf8.RuneError
return r <= ' ' || r == '=' || r == '"' || r == 0x7f || r == utf8.RuneError
}
func writeStringValue(w io.Writer, value string, ok bool) error {
@@ -276,7 +276,7 @@ func (enc *Encoder) Reset() {
func safeError(err error) (s string, ok bool) {
defer func() {
if panicVal := recover(); panicVal != nil {
if v := reflect.ValueOf(err); v.Kind() == reflect.Ptr && v.IsNil() {
if v := reflect.ValueOf(err); v.Kind() == reflect.Pointer && v.IsNil() {
s, ok = "null", false
} else {
s, ok = fmt.Sprintf("PANIC:%v", panicVal), false
@@ -290,7 +290,7 @@ func safeError(err error) (s string, ok bool) {
func safeString(str fmt.Stringer) (s string, ok bool) {
defer func() {
if panicVal := recover(); panicVal != nil {
if v := reflect.ValueOf(str); v.Kind() == reflect.Ptr && v.IsNil() {
if v := reflect.ValueOf(str); v.Kind() == reflect.Pointer && v.IsNil() {
s, ok = "null", false
} else {
s, ok = fmt.Sprintf("PANIC:%v", panicVal), true
@@ -304,7 +304,7 @@ func safeString(str fmt.Stringer) (s string, ok bool) {
func safeMarshal(tm encoding.TextMarshaler) (b []byte, err error) {
defer func() {
if panicVal := recover(); panicVal != nil {
if v := reflect.ValueOf(tm); v.Kind() == reflect.Ptr && v.IsNil() {
if v := reflect.ValueOf(tm); v.Kind() == reflect.Pointer && v.IsNil() {
b, err = nil, nil
} else {
b, err = nil, fmt.Errorf("panic when marshalling: %s", panicVal)

View File

@@ -19,7 +19,7 @@ import (
var hex = "0123456789abcdef"
var bufferPool = sync.Pool{
New: func() interface{} {
New: func() any {
return &bytes.Buffer{}
},
}
@@ -40,7 +40,7 @@ func writeQuotedString(w io.Writer, s string) (int, error) {
start := 0
for i := 0; i < len(s); {
if b := s[i]; b < utf8.RuneSelf {
if 0x20 <= b && b != '\\' && b != '"' {
if 0x20 <= b && b != '\\' && b != '"' && b != 0x7f {
i++
continue
}
@@ -91,14 +91,14 @@ func writeQuotedString(w io.Writer, s string) (int, error) {
return n, err
}
// NOTE: keep in sync with writeQuoteString above.
// NOTE: keep in sync with writeQuotedString above.
func writeQuotedBytes(w io.Writer, s []byte) (int, error) {
buf := getBuffer()
buf.WriteByte('"')
start := 0
for i := 0; i < len(s); {
if b := s[i]; b < utf8.RuneSelf {
if 0x20 <= b && b != '\\' && b != '"' {
if 0x20 <= b && b != '\\' && b != '"' && b != 0x7f {
i++
continue
}

4
vendor/modules.txt vendored
View File

@@ -898,8 +898,8 @@ github.com/go-kit/kit/log/level
## explicit; go 1.17
github.com/go-kit/log
github.com/go-kit/log/level
# github.com/go-logfmt/logfmt v0.6.0
## explicit; go 1.17
# github.com/go-logfmt/logfmt v0.6.1
## explicit; go 1.21
github.com/go-logfmt/logfmt
# github.com/go-logr/logr v1.4.3
## explicit; go 1.18