[#14] Fix linter warnings

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-11-01 11:02:16 +03:00
parent 76372aac04
commit 7f6ee39cb8
4 changed files with 4 additions and 5 deletions

View file

@ -101,7 +101,7 @@ func (c *Condition) Match(req Request) bool {
switch c.Op {
default:
panic(fmt.Sprintf("unimplemented: %s", c.Op))
panic(fmt.Sprintf("unimplemented: %d", c.Op))
case CondStringEquals:
return val == c.Value
case CondStringNotEquals:
@ -153,7 +153,6 @@ func (r *Rule) matchCondition(obj Request) (status Status, matched bool) {
func (r *Rule) matchAny(obj Request) (status Status, matched bool) {
for i := range r.Condition {
if r.Condition[i].Match(obj) {
return r.Status, true
}
}

View file

@ -2,7 +2,7 @@ package policyengine
import "fmt"
// Status is the status for policy application
// Status is the status for policy application.
type Status byte
const (

View file

@ -109,6 +109,7 @@ func (p Policy) ToChain() (*policyengine.Chain, error) {
return &chain, nil
}
//nolint:funlen
func (c Conditions) ToChainCondition() ([]policyengine.Condition, error) {
var conditions []policyengine.Condition

View file

@ -20,8 +20,7 @@ func NewInMemory() CachedChainStorage {
}
}
// TODO параметры для actor (IP)
// TODO
// IsAllowed implements the Engine interface.
func (s *inmemory) IsAllowed(name Name, namespace string, r Request) (Status, bool) {
var ruleFound bool
if local, ok := s.local[name]; ok {