From 7c5ba70b402fd1ceb4641fb2f5be4196357a645a Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Sat, 29 Jun 2024 22:52:31 +0100 Subject: [PATCH] feat(aa): add missing methods for the Link struct. --- pkg/aa/file.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/aa/file.go b/pkg/aa/file.go index 88b08c08..50b23bae 100644 --- a/pkg/aa/file.go +++ b/pkg/aa/file.go @@ -284,3 +284,21 @@ func (r *Link) Compare(other Rule) int { func (r *Link) Merge(other Rule) bool { return false // Never merge link } + +func (r *Link) Lengths() []int { + return []int{ + r.Qualifier.getLenAudit(), + r.Qualifier.getLenAccess(), + length("owner", r.Owner), + length("subset", r.Subset), + length("", r.Path), + length("", r.Target), + } +} + +func (r *Link) setPaddings(max []int) { + r.Paddings = append(r.Qualifier.setPaddings(max[:2]), setPaddings( + max[2:], []string{"owner", "subset", "", ""}, + []any{r.Owner, r.Subset, r.Path, r.Target})..., + ) +}