Run of fresh-releases for golang-pault-go-topsort

Try this locally (using the lintian-brush package):

debcheckout golang-pault-go-topsort
cd golang-pault-go-topsort
new-upstream

Merge these changes:

Summary

Merged new upstream version: 0.0~git20210425.3860c0f (was: 0.0~git20160529.f98d2ad).

Diff

Branch: main

diff --git a/debian/changelog b/debian/changelog
index 8bcf48b..5654e5a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,12 +1,13 @@
-golang-pault-go-topsort (0.0~git20160529.f98d2ad-2) UNRELEASED; urgency=low
+golang-pault-go-topsort (0.0~git20210425.3860c0f-1) UNRELEASED; urgency=low
 
   * Bump debhelper from old 11 to 12.
   * Set debhelper-compat version in Build-Depends.
   * Set upstream metadata fields: Bug-Database, Bug-Submit.
   * Apply multi-arch hints.
     + golang-pault-go-topsort-dev: Add Multi-Arch: foreign.
+  * New upstream snapshot.
 
- -- Debian Janitor <janitor@jelmer.uk>  Sat, 06 Jun 2020 19:44:39 -0000
+ -- Debian Janitor <janitor@jelmer.uk>  Sat, 29 May 2021 00:29:01 -0000
 
 golang-pault-go-topsort (0.0~git20160529.f98d2ad-1) unstable; urgency=medium
 
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..2254272
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,3 @@
+module pault.ag/go/topsort
+
+go 1.16
diff --git a/topsort.go b/topsort.go
index 2700230..7bc2033 100644
--- a/topsort.go
+++ b/topsort.go
@@ -47,7 +47,8 @@ func (tn *Network) Sort() ([]*Node, error) {
 }
 
 func (tn *Network) Get(name string) *Node {
-	return tn.nodes[name]
+	node, _ := tn.nodes[name]
+	return node
 }
 
 func (tn *Network) AddNode(name string, value interface{}) *Node {
@@ -102,8 +103,18 @@ func (tn *Network) AddEdge(from string, to string) error {
 	return nil
 }
 
-func (tn *Network) AddEdgeIfExists(from string, to string) {
-	tn.AddEdge(from, to)
+func (tn *Network) AddEdgeAndNodes(from string, to string) error {
+	fromNode := tn.Get(from)
+	if fromNode == nil {
+		fromNode = tn.AddNode(from, nil)
+	}
+
+	toNode := tn.Get(to)
+	if toNode == nil {
+		toNode = tn.AddNode(to, nil)
+	}
+
+	return tn.AddEdge(from, to)
 }
 
 // }}}
diff --git a/topsort_test.go b/topsort_test.go
index 5badfa2..f5c38d5 100644
--- a/topsort_test.go
+++ b/topsort_test.go
@@ -185,4 +185,12 @@ func TestReSort(t *testing.T) {
 	assert(t, series[3].Name == "B")
 }
 
+func TestTopsortEasyEdges(t *testing.T) {
+	network := topsort.NewNetwork()
+	network.AddEdgeAndNodes("foo", "bar")
+	series, err := network.Sort()
+	isok(t, err)
+	assert(t, len(series) == 2)
+}
+
 // vim: foldmethod=marker

Branch: upstream

Tag: upstream/0.0_git20210425.3860c0f

Diff is too long (more than 200 lines). Download the raw diff.

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/pault.ag/go/topsort/go.mod

No differences were encountered in the control files

Resulting package

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

apt install -t fresh-releases golang-pault-go-topsort-dev

Lintian Result

Full worker log Full build log