diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-06-01 14:59:37 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-06-01 14:59:37 +0200 |
commit | d5a5864dbd325dd53c185fedf4e1969cc6ad4da5 (patch) | |
tree | b1da7a4d7ab48a033f678134e61e22967c29e416 /skate/cmd | |
parent | 4e0e04ade9bdfef46b7f2467893abab941f5a1fd (diff) | |
download | refcat-d5a5864dbd325dd53c185fedf4e1969cc6ad4da5.tar.gz refcat-d5a5864dbd325dd53c185fedf4e1969cc6ad4da5.zip |
add -B best effort flag, newline handling
Diffstat (limited to 'skate/cmd')
-rw-r--r-- | skate/cmd/skate-resolve-journal-name/main.go | 9 |
1 files changed, 8 insertions, 1 deletions
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 }) |