diff --git a/go.mod b/go.mod index fbe04d4..64968e5 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,12 @@ module github.com/s0rg/decompose go 1.22 require ( - github.com/docker/docker v25.0.4+incompatible + github.com/docker/docker v25.0.5+incompatible github.com/emicklei/dot v1.6.1 github.com/expr-lang/expr v1.16.1 github.com/prometheus/procfs v0.13.0 github.com/s0rg/set v1.2.0 - github.com/s0rg/trie v1.3.0 + github.com/s0rg/trie v1.3.1 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index fcf5158..69c9db5 100644 --- a/go.sum +++ b/go.sum @@ -11,8 +11,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v25.0.4+incompatible h1:XITZTrq+52tZyZxUOtFIahUf3aH367FLxJzt9vZeAF8= -github.com/docker/docker v25.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE= +github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -64,8 +64,8 @@ github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBO github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/s0rg/set v1.2.0 h1:53b207YMktNQJXYei/oHuTR5oOO2e9+eieZOncYsh9g= github.com/s0rg/set v1.2.0/go.mod h1:xz3nDbjF4nyMLvAHvmE7rigXpNrKKTsi6iANznIB1/4= -github.com/s0rg/trie v1.3.0 h1:VeMjAJdVvAMt06QlrLJs9B7tplwyxGtCPPZHfvW4Duo= -github.com/s0rg/trie v1.3.0/go.mod h1:P+hJUWvPu/imKrsdzOrVswr8Mme6GgFtZfBKojYYkfk= +github.com/s0rg/trie v1.3.1 h1:O9THfLSiXqBN08gJoHegwdkkaGIIs3GnXlYQswfXWTk= +github.com/s0rg/trie v1.3.1/go.mod h1:BGS9ZEqxUvxDT+4qai+YZnzvUDvTpJrx8zBtP7LBjS8= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/internal/graph/compress.go b/internal/graph/compress.go index ea768f2..ca13289 100644 --- a/internal/graph/compress.go +++ b/internal/graph/compress.go @@ -8,9 +8,10 @@ import ( "slices" "strings" - "github.com/s0rg/decompose/internal/node" "github.com/s0rg/set" "github.com/s0rg/trie" + + "github.com/s0rg/decompose/internal/node" ) const ( @@ -83,8 +84,11 @@ func (c *Compressor) Write(w io.Writer) (err error) { } func (c *Compressor) buildGroups() (index map[string]string, err error) { - seen := make(set.Unordered[string]) + index = make(map[string]string) + groups := make(map[string][]string) + t := trie.New[string]() + seen := make(set.Unordered[string]) for _, node := range c.nodes { seen.Add(node.ID) @@ -97,8 +101,6 @@ func (c *Compressor) buildGroups() (index map[string]string, err error) { } comm := t.Common("", defaultDiff) - groups := make(map[string][]string) - index = make(map[string]string) for _, key := range comm { nodes := []string{}