mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 19:50:18 +00:00
feat: support unique when format result, https://github.com/chainreactors/spray/issues/104
This commit is contained in:
parent
0a833b0326
commit
20b70d0dcd
@ -25,7 +25,7 @@ func Format(opts Option) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
group := make(map[string][]*baseline.Baseline)
|
group := make(map[string]map[string]*baseline.Baseline)
|
||||||
for _, line := range bytes.Split(bytes.TrimSpace(content), []byte("\n")) {
|
for _, line := range bytes.Split(bytes.TrimSpace(content), []byte("\n")) {
|
||||||
var result baseline.Baseline
|
var result baseline.Baseline
|
||||||
err := json.Unmarshal(line, &result)
|
err := json.Unmarshal(line, &result)
|
||||||
@ -37,7 +37,10 @@ func Format(opts Option) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
group[result.Url.Host] = append(group[result.Url.Host], &result)
|
if _, exists := group[result.Url.Host]; !exists {
|
||||||
|
group[result.Url.Host] = make(map[string]*baseline.Baseline)
|
||||||
|
}
|
||||||
|
group[result.Url.Host][result.Path] = &result
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, results := range group {
|
for _, results := range group {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user