1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-06-20 01:19:23 +02:00

Bump github.com/sanity-io/litter from 1.5.2 to 1.5.8 (#5451)

Bumps [github.com/sanity-io/litter](https://github.com/sanity-io/litter)
from 1.5.2 to 1.5.8.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/sanity-io/litter/commit/4fde30cab354d1dc18c21d2a1b9ac5c75600ec19"><code>4fde30c</code></a>
fix: fixes panic on unexported field access.</li>
<li><a
href="https://github.com/sanity-io/litter/commit/61ca8aa20ab3dd224ead03cb8e89e9ba38ad5116"><code>61ca8aa</code></a>
feat: support <code>FormatTime</code>.</li>
<li><a
href="https://github.com/sanity-io/litter/commit/3d1485f1f260405aa7f9b4f7e573c3d4809ec302"><code>3d1485f</code></a>
chore: fix deprecations.</li>
<li><a
href="https://github.com/sanity-io/litter/commit/7e132579048ac450c3cbcd4d448efbae937017e1"><code>7e13257</code></a>
feat: adds <code>D()</code>, a shorthand for <code>Dump()</code>.</li>
<li><a
href="https://github.com/sanity-io/litter/commit/f2ba02b77978d2fb5030483056f1939027fd1abc"><code>f2ba02b</code></a>
fix: don't cache array/slice length when traversing.</li>
<li><a
href="https://github.com/sanity-io/litter/commit/c028d3cb966dda224fc5c54dda5b246b478fe149"><code>c028d3c</code></a>
ci: adds GitHub Actions action.</li>
<li><a
href="https://github.com/sanity-io/litter/commit/cfce9160a04515cc54f0b6fb4c0e2eb1c6edf590"><code>cfce916</code></a>
Fix pointer resued in maps key</li>
<li><a
href="https://github.com/sanity-io/litter/commit/65e672ecd4d7f12e1e7da5ca7185ffea6cc8ac9f"><code>65e672e</code></a>
ci: removes .travis.yml, which is no longer operative</li>
<li>See full diff in <a
href="https://github.com/sanity-io/litter/compare/v1.5.2...v1.5.8">compare
view</a></li>
</ul>
</details>
<br />
This commit is contained in:
Stefan Haller
2026-03-31 13:54:21 +02:00
committed by GitHub
6 changed files with 43 additions and 22 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ require (
github.com/rivo/uniseg v0.4.7
github.com/sahilm/fuzzy v0.1.0
github.com/samber/lo v1.31.0
github.com/sanity-io/litter v1.5.2
github.com/sanity-io/litter v1.5.8
github.com/sasha-s/go-deadlock v0.3.6
github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero v1.15.0
+2 -2
View File
@@ -102,8 +102,8 @@ github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI=
github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
github.com/samber/lo v1.31.0 h1:Sfa+/064Tdo4SvlohQUQzBhgSer9v/coGvKQI/XLWAM=
github.com/samber/lo v1.31.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8=
github.com/sanity-io/litter v1.5.2 h1:AnC8s9BMORWH5a4atZ4D6FPVvKGzHcnc5/IVTa87myw=
github.com/sanity-io/litter v1.5.2/go.mod h1:5Z71SvaYy5kcGtyglXOC9rrUi3c1E8CamFWjQsazTh0=
github.com/sanity-io/litter v1.5.8 h1:uM/2lKrWdGbRXDrIq08Lh9XtVYoeGtcQxk9rtQ7+rYg=
github.com/sanity-io/litter v1.5.8/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U=
github.com/sasha-s/go-deadlock v0.3.6 h1:TR7sfOnZ7x00tWPfD397Peodt57KzMDo+9Ae9rMiUmw=
github.com/sasha-s/go-deadlock v0.3.6/go.mod h1:CUqNyyvMxTyjFqDT7MRg9mb4Dv/btmGTqSR+rky/UXo=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
-7
View File
@@ -1,7 +0,0 @@
arch:
- amd64
- ppc64le
language: go
go:
- 1.14.x
+36 -8
View File
@@ -11,6 +11,7 @@ import (
"sort"
"strconv"
"strings"
"time"
)
var (
@@ -40,6 +41,9 @@ type Options struct {
// when it's safe. This is useful for diffing two structures, where pointer variables would cause
// false changes. However, circular graphs are still detected and elided to avoid infinite output.
DisablePointerReplacement bool
// FormatTime, if true, will format [time.Time] values.
FormatTime bool
}
// Config is the default config used when calling Dump
@@ -59,6 +63,7 @@ type dumpState struct {
parentPointers ptrmap
currentPointer *ptrinfo
homePackageRegexp *regexp.Regexp
timeFormatter func(t time.Time) string
}
func (s *dumpState) write(b []byte) {
@@ -129,6 +134,14 @@ func (s *dumpState) dumpSlice(v reflect.Value) {
}
func (s *dumpState) dumpStruct(v reflect.Value) {
if v.CanInterface() {
val := v.Interface()
if t, ok := val.(time.Time); ok && s.timeFormatter != nil {
s.writeString(s.timeFormatter(t))
return
}
}
dumpPreamble := func() {
s.dumpType(v)
s.write([]byte("{"))
@@ -246,7 +259,6 @@ func (s *dumpState) dumpChan(v reflect.Value) {
}
func (s *dumpState) dumpCustom(v reflect.Value, buf *bytes.Buffer) {
// Dump the type
s.dumpType(v)
@@ -293,6 +305,8 @@ func (s *dumpState) dump(value interface{}) {
s.dumpVal(v)
}
var dumperType = reflect.TypeOf((*Dumper)(nil)).Elem()
func (s *dumpState) descendIntoPossiblePointer(value reflect.Value, f func()) {
canonicalize := true
if isPointerValue(value) {
@@ -345,7 +359,6 @@ func (s *dumpState) dumpVal(value reflect.Value) {
}
// Handle custom dumpers
dumperType := reflect.TypeOf((*Dumper)(nil)).Elem()
if v.Type().Implements(dumperType) {
s.descendIntoPossiblePointer(v, func() {
// Run the custom dumper buffering the output
@@ -457,13 +470,23 @@ func (s *dumpState) pointerFor(v reflect.Value) (*ptrinfo, bool) {
}
// prepares a new state object for dumping the provided value
func newDumpState(value interface{}, options *Options, writer io.Writer) *dumpState {
func newDumpState(value reflect.Value, options *Options, writer io.Writer) *dumpState {
result := &dumpState{
config: options,
pointers: mapReusedPointers(reflect.ValueOf(value)),
pointers: mapReusedPointers(value),
w: writer,
}
if options.FormatTime {
result.timeFormatter = func(t time.Time) string {
t = t.In(time.UTC)
return fmt.Sprintf(
`time.Date(%d, %d, %d, %d, %d, %d, %d, time.UTC)`,
t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(),
)
}
}
if options.HomePackage != "" {
result.homePackageRegexp = regexp.MustCompile(fmt.Sprintf("\\b%s\\.", options.HomePackage))
}
@@ -471,12 +494,17 @@ func newDumpState(value interface{}, options *Options, writer io.Writer) *dumpSt
return result
}
// Dump a value to stdout
// Dump a value to stdout.
func Dump(value ...interface{}) {
(&Config).Dump(value...)
}
// Sdump dumps a value to a string
// D dumps a value to stdout, and is a shorthand for [Dump].
func D(value ...interface{}) {
Dump(value...)
}
// Sdump dumps a value to a string.
func Sdump(value ...interface{}) string {
return (&Config).Sdump(value...)
}
@@ -484,7 +512,7 @@ func Sdump(value ...interface{}) string {
// Dump a value to stdout according to the options
func (o Options) Dump(values ...interface{}) {
for i, value := range values {
state := newDumpState(value, &o, os.Stdout)
state := newDumpState(reflect.ValueOf(value), &o, os.Stdout)
if i > 0 {
state.write([]byte(o.Separator))
}
@@ -500,7 +528,7 @@ func (o Options) Sdump(values ...interface{}) string {
if i > 0 {
_, _ = buf.Write([]byte(o.Separator))
}
state := newDumpState(value, &o, buf)
state := newDumpState(reflect.ValueOf(value), &o, buf)
state.dump(value)
}
return buf.String()
+2 -2
View File
@@ -118,8 +118,7 @@ func (pv *pointerVisitor) consider(v reflect.Value) {
// Now descend into any children of this value
switch v.Kind() {
case reflect.Slice, reflect.Array:
numEntries := v.Len()
for i := 0; i < numEntries; i++ {
for i := 0; i < v.Len(); i++ {
pv.consider(v.Index(i))
}
@@ -136,6 +135,7 @@ func (pv *pointerVisitor) consider(v reflect.Value) {
options: &Config,
})
for _, key := range keys {
pv.consider(key)
pv.consider(v.MapIndex(key))
}
+2 -2
View File
@@ -152,8 +152,8 @@ github.com/sahilm/fuzzy
# github.com/samber/lo v1.31.0
## explicit; go 1.18
github.com/samber/lo
# github.com/sanity-io/litter v1.5.2
## explicit; go 1.14
# github.com/sanity-io/litter v1.5.8
## explicit; go 1.16
github.com/sanity-io/litter
# github.com/sasha-s/go-deadlock v0.3.6
## explicit