fix: check outputs
This commit is contained in:
parent
85453aa315
commit
cb14d38e50
1 changed files with 15 additions and 0 deletions
|
@ -173,6 +173,10 @@ func (r *Reporter) SetOutputs(outputs map[string]string) {
|
|||
defer r.stateMu.Unlock()
|
||||
|
||||
for k, v := range outputs {
|
||||
if len(k) > 255 {
|
||||
r.Logf("ignore output because the key is too long: %q", k)
|
||||
continue
|
||||
}
|
||||
if _, ok := r.outputs.Load(k); ok {
|
||||
continue
|
||||
}
|
||||
|
@ -282,6 +286,17 @@ func (r *Reporter) ReportState() error {
|
|||
r.cancel()
|
||||
}
|
||||
|
||||
var noSent []string
|
||||
r.outputs.Range(func(k, v interface{}) bool {
|
||||
if _, ok := v.(string); ok {
|
||||
noSent = append(noSent, k.(string))
|
||||
}
|
||||
return true
|
||||
})
|
||||
if len(noSent) >= 0 {
|
||||
return fmt.Errorf("there are still outputs that have not been sent: %v", noSent)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue