chore: make deps

This commit is contained in:
2025-11-11 14:18:57 +01:00
parent db7c4042d0
commit 45af67d22d
590 changed files with 22837 additions and 16387 deletions

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
}