diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-06-01 19:25:24 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-06-01 19:25:24 +0200 |
commit | 389a33349bcd30e2d78cb971edf945c95b61aee2 (patch) | |
tree | 4831c585265f18aa49bb99a31afc1085b6d37f88 /skate | |
parent | 79e0cf1384f28202769b6633d7f066686f526f09 (diff) | |
download | refcat-389a33349bcd30e2d78cb971edf945c95b61aee2.tar.gz refcat-389a33349bcd30e2d78cb971edf945c95b61aee2.zip |
map: readability
Diffstat (limited to 'skate')
-rw-r--r-- | skate/map.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/skate/map.go b/skate/map.go index 1d21818..334471c 100644 --- a/skate/map.go +++ b/skate/map.go @@ -245,15 +245,19 @@ func MapperReleaseContainerName(p []byte) (fields [][]byte, err error) { var ( doc Release key []byte + w string ) if err := json.Unmarshal(p, &doc); err != nil { return nil, err } if doc.Container.Name != "" { - key = []byte(sandcrawlerSlugify(wsReplacer.Replace(strings.TrimSpace(doc.Container.Name)))) + w = doc.Container.Name } else if doc.ContainerName != "" { - key = []byte(sandcrawlerSlugify(wsReplacer.Replace(strings.TrimSpace(doc.ContainerName)))) + w = doc.ContainerName + } else { + w = doc.Extra.ContainerName } + key = []byte(sandcrawlerSlugify(wsReplacer.Replace(strings.TrimSpace(w)))) return [][]byte{key, p}, nil } |