diff --git a/internal/pkg/ir.go b/internal/pkg/ir.go index f40cd87..58dcbfe 100644 --- a/internal/pkg/ir.go +++ b/internal/pkg/ir.go @@ -254,15 +254,16 @@ func (c *Cache) encodeAll( a Artifact, encoded map[Artifact]struct{}, ) (err error) { + if _, ok := encoded[a]; ok { + return + } + for _, d := range a.Dependencies() { if err = c.encodeAll(w, d, encoded); err != nil { return } } - if _, ok := encoded[a]; ok { - return - } encoded[a] = struct{}{} return c.Encode(w, a) }