From d5a5864dbd325dd53c185fedf4e1969cc6ad4da5 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 1 Jun 2021 14:59:37 +0200 Subject: add -B best effort flag, newline handling --- skate/cmd/skate-resolve-journal-name/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'skate/cmd/skate-resolve-journal-name/main.go') diff --git a/skate/cmd/skate-resolve-journal-name/main.go b/skate/cmd/skate-resolve-journal-name/main.go index 7f4b53d..2351730 100644 --- a/skate/cmd/skate-resolve-journal-name/main.go +++ b/skate/cmd/skate-resolve-journal-name/main.go @@ -50,7 +50,11 @@ func main() { return nil, fmt.Errorf("column mismatch") } if err = json.Unmarshal(fields[*column-1], &release); err != nil { - return nil, err + if *bestEffort { + log.Printf("failed to unmarshal: %v", string(p)) + } else { + return nil, err + } } name := strings.ToLower(release.ContainerName) results := ms.Lookup(name, -1) @@ -68,6 +72,9 @@ func main() { if err != nil { return nil, err } + if len(fields) == *column { + b = append(b, []byte("\n")...) + } fields[*column-1] = b return bytes.Join(fields, []byte(*sep)), nil }) -- cgit v1.2.3