Run of fresh-snapshots for golang-github-sanity-io-litter

Merge these changes:

Summary

Merged new upstream version: 1.5.5 (was: 1.5.2).

Diff

Branch: main

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..bb3e7cd
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,20 @@
+name: Test
+
+on:
+  push:
+
+jobs:
+  scheduled:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Check out this repo
+      uses: actions/checkout@v2
+    - name: Set up Go
+      uses: actions/setup-go@v2
+      with: {go-version: '^1.16'}
+    - name: Download dependencies
+      run: go mod download
+    - name: Build
+      run: go build ./...
+    - name: Test
+      run: go test ./...
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index ec9381c..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-arch:
-- amd64
-- ppc64le
-
-language: go
-go:
-- 1.14.x
diff --git a/debian/changelog b/debian/changelog
index 8598835..a51001e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-sanity-io-litter (1.5.5-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Sat, 07 May 2022 19:05:14 -0000
+
 golang-github-sanity-io-litter (1.5.2-1) unstable; urgency=medium
 
   * New upstream version 1.5.2
diff --git a/dump.go b/dump.go
index 3dfbb9d..03e311e 100644
--- a/dump.go
+++ b/dump.go
@@ -457,10 +457,10 @@ 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,
 	}
 
@@ -484,7 +484,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 +500,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()
diff --git a/dump_test.go b/dump_test.go
index 26fd3e5..68d265c 100644
--- a/dump_test.go
+++ b/dump_test.go
@@ -243,6 +243,21 @@ func TestSdump_maps(t *testing.T) {
 	})
 }
 
+func TestSdump_RecursiveMaps(t *testing.T) {
+	mp := make(map[*RecursiveStruct]*RecursiveStruct)
+	k1 := &RecursiveStruct{}
+	k1.Ptr = k1
+	v1 := &RecursiveStruct{}
+	v1.Ptr = v1
+	k2 := &RecursiveStruct{}
+	k2.Ptr = k2
+	v2 := &RecursiveStruct{}
+	v2.Ptr = v2
+	mp[k1] = v1
+	mp[k2] = v2
+	runTests(t, "recursive_maps", mp)
+}
+
 var standardCfg = litter.Options{}
 
 func runTestWithCfg(t *testing.T, name string, cfg *litter.Options, cases ...interface{}) {
diff --git a/go.mod b/go.mod
index c1c20c9..17be31b 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module github.com/sanity-io/litter
 
-go 1.14
+go 1.16
 
 require (
 	github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b // indirect
diff --git a/pointers.go b/pointers.go
index 2c57d79..74b9a0f 100644
--- a/pointers.go
+++ b/pointers.go
@@ -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))
 		}
 
diff --git a/testdata/recursive_maps.dump b/testdata/recursive_maps.dump
new file mode 100644
index 0000000..4a0218b
--- /dev/null
+++ b/testdata/recursive_maps.dump
@@ -0,0 +1,12 @@
+map[*litter_test.RecursiveStruct]*litter_test.RecursiveStruct{
+  &litter_test.RecursiveStruct{ // p0
+    Ptr: p0,
+  }: &litter_test.RecursiveStruct{ // p1
+    Ptr: p1,
+  },
+  &litter_test.RecursiveStruct{ // p2
+    Ptr: p2,
+  }: &litter_test.RecursiveStruct{ // p3
+    Ptr: p3,
+  },
+}
\ No newline at end of file

Branch: pristine-tar

diff --git a/golang-github-sanity-io-litter_1.5.5.orig.tar.gz.delta b/golang-github-sanity-io-litter_1.5.5.orig.tar.gz.delta
new file mode 100644
index 0000000..a936bba
Binary files /dev/null and b/golang-github-sanity-io-litter_1.5.5.orig.tar.gz.delta differ
diff --git a/golang-github-sanity-io-litter_1.5.5.orig.tar.gz.id b/golang-github-sanity-io-litter_1.5.5.orig.tar.gz.id
new file mode 100644
index 0000000..10fdc12
--- /dev/null
+++ b/golang-github-sanity-io-litter_1.5.5.orig.tar.gz.id
@@ -0,0 +1 @@
+2fdbf16b8c66f33ff380e3b67cc2c8735853a627

Publish Blockers

  • ☑ run was successful
  • ☑ package has not been removed from the archive
  • ☑ command has not changed
  • ☒ not yet reviewed, but review needed
  • ☑ 0 publish attempts so far.not currently attempting to back off
  • ☒ merge proposals for the package maintainer are currently being rate-limited (open: 1257, max open: 300)
  • ☑ change set 269c64db-b73e-4d2c-ac71-83342a8e202e is ready

Resulting package

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots golang-github-sanity-io-litter-dev

Lintian Result

Full worker log Full build log