mirror of
https://github.com/moby/moby.git
synced 2026-08-03 22:51:03 +00:00
Looks like the linter didn't detect this in de71462b97
daemon/libnetwork/internal/nftables/fluentapi_linux.go:8:20: ST1016: methods on the same type should have the same receiver name (seen 1x "b", 2x "cd") (staticcheck)
func (b BaseChain) Builder() chainBuilder {
^
daemon/libnetwork/internal/nftables/fluentapi_linux.go:14:16: ST1016: methods on the same type should have the same receiver name (seen 1x "c", 2x "cd") (staticcheck)
func (c Chain) Builder() chainBuilder {
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
31 lines
553 B
Go
31 lines
553 B
Go
package nftables
|
|
|
|
type chainBuilder struct {
|
|
chain string
|
|
tm *Modifier
|
|
}
|
|
|
|
func (cd BaseChain) Builder() chainBuilder {
|
|
tm := &Modifier{}
|
|
tm.create(cd, 1)
|
|
return chainBuilder{chain: cd.Name, tm: tm}
|
|
}
|
|
|
|
func (cd Chain) Builder() chainBuilder {
|
|
tm := &Modifier{}
|
|
tm.create(cd, 1)
|
|
return chainBuilder{chain: cd.Name, tm: tm}
|
|
}
|
|
|
|
func (b chainBuilder) Rule(rule ...string) chainBuilder {
|
|
b.tm.create(Rule{
|
|
Chain: b.chain,
|
|
Rule: rule,
|
|
}, 1)
|
|
return b
|
|
}
|
|
|
|
func (b chainBuilder) Create(tm *Modifier) {
|
|
tm.cmds = append(tm.cmds, b.tm.cmds...)
|
|
}
|