forked from go-toolset/pepperlint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rule_chan_type.go
28 lines (23 loc) · 722 Bytes
/
rule_chan_type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package pepperlint
import (
"go/ast"
)
// ChanTypeRules is a list of type ChanTypeRule.
type ChanTypeRules []ChanTypeRule
// ValidateChanType will iterate through the list of array types and call
// ValidateChanType. If an error is returned, then that error will be added
// to the batch of errors.
func (rules ChanTypeRules) ValidateChanType(ch *ast.ChanType) error {
batchError := NewBatchError()
for _, rule := range rules {
if err := rule.ValidateChanType(ch); err != nil {
batchError.Add(err)
}
}
return batchError.Return()
}
// ChanTypeRule represents an interface that will allow for validation
// to occur on an ast.ChanType.
type ChanTypeRule interface {
ValidateChanType(*ast.ChanType) error
}