New Upstream Release - golang-github-sanity-io-litter
Ready changes
Summary
Merged new upstream version: 1.5.5 (was: 1.5.2).
Resulting package
Built on 2022-05-07T19:12 (took 5m1s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases golang-github-sanity-io-litter-dev
Lintian Result
Diff
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..2d8a96b 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:07:58 -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
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/share/gocode/src/github.com/sanity-io/litter/testdata/recursive_maps.dump
No differences were encountered in the control files