Skip to content

Commit

Permalink
feat: enable more lint rules (#1376)
Browse files Browse the repository at this point in the history
* feat: enable `errorlint` lint rule

* feat: enable `stylecheck` lint rule without `ST1003`

* feat: enable `revive` lint rule without `unused-parameter`

* feat: enable `goconst` lint rule

* feat: enable `cyclop` `funlen` `gocyclo` `nestif` lint rule

* Revert "feat: enable `errorlint` lint rule"

This reverts commit 3b56fa9.

* Revert "feat: enable `goconst` lint rule"

This reverts commit 8cec408.
  • Loading branch information
MuZhou233 committed Mar 18, 2024
1 parent 2f7619f commit c929fd5
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 48 deletions.
22 changes: 16 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ linters-settings:
# Default: false
all: true

stylecheck:
# STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"]
checks: ["all", "-ST1003"]

revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
disabled: true

linters:
disable-all: true
Expand All @@ -208,7 +218,7 @@ linters:
- asciicheck # checks that your code does not contain non-ASCII identifiers
- bidichk # checks for dangerous unicode character sequences
- bodyclose # checks whether HTTP response body is closed successfully
#- cyclop # checks function and package cyclomatic complexity
- cyclop # checks function and package cyclomatic complexity
- dupl # tool for code clone detection
- durationcheck # checks for two durations multiplied together
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
Expand All @@ -217,15 +227,15 @@ linters:
- exhaustive # checks exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
#- forbidigo # forbids identifiers
#- funlen # tool for detection of long functions
- funlen # tool for detection of long functions
- gocheckcompilerdirectives # validates go compiler directive comments (//go:)
#- gochecknoglobals # checks that no global variables exist
- gochecknoinits # checks that no init functions are present in Go code
- gochecksumtype # checks exhaustiveness on Go "sum types"
#- gocognit # computes and checks the cognitive complexity of functions
#- goconst # finds repeated strings that could be replaced by a constant
#- gocritic # provides diagnostics that check for bugs, performance and style issues
#- gocyclo # computes and checks the cyclomatic complexity of functions
- gocyclo # computes and checks the cyclomatic complexity of functions
- godot # checks if comments end in a period
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
#- gomnd # detects magic numbers
Expand All @@ -239,7 +249,7 @@ linters:
- mirror # reports wrong mirror patterns of bytes/strings usage
- musttag # enforces field tags in (un)marshaled structs
- nakedret # finds naked returns in functions greater than a specified function length
#- nestif # reports deeply nested if statements
- nestif # reports deeply nested if statements
- nilerr # finds the code that returns nil even if it checks that the error is not nil
#- nilnil # checks that there is no simultaneous return of nil error and an invalid value
- noctx # finds sending http request without context.Context
Expand All @@ -251,12 +261,12 @@ linters:
- promlinter # checks Prometheus metrics naming via promlint
- protogetter # reports direct reads from proto message fields when getters should be used
- reassign # checks that package variables are not reassigned
#- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
- rowserrcheck # checks whether Err of rows is checked successfully
- sloglint # ensure consistent code style when using log/slog
- spancheck # checks for mistakes with OpenTelemetry/Census spans
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
#- stylecheck # is a replacement for golint
- stylecheck # is a replacement for golint
- tenv # detects using os.Setenv instead of t.Setenv since Go1.17
- testableexamples # checks if examples are testable (have an expected output)
- testifylint # checks usage of github.com/stretchr/testify
Expand Down
2 changes: 1 addition & 1 deletion effector/effector.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package effector
package effector //nolint:cyclop // TODO

// Effect is the result for a policy rule.
type Effect int
Expand Down
13 changes: 7 additions & 6 deletions enforcer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ func NewEnforcer(params ...interface{}) (*Enforcer, error) {
}
}

if paramLen-parsedParamLen == 2 {
switch paramLen - parsedParamLen {
case 2:
switch p0 := params[0].(type) {
case string:
switch p1 := params[1].(type) {
Expand All @@ -126,7 +127,7 @@ func NewEnforcer(params ...interface{}) (*Enforcer, error) {
}
}
}
} else if paramLen-parsedParamLen == 1 {
case 1:
switch p0 := params[0].(type) {
case string:
err := e.InitWithFile(p0, "")
Expand All @@ -139,9 +140,9 @@ func NewEnforcer(params ...interface{}) (*Enforcer, error) {
return nil, err
}
}
} else if paramLen-parsedParamLen == 0 {
case 0:
return e, nil
} else {
default:
return nil, errors.New("invalid parameters for enforcer")
}

Expand Down Expand Up @@ -586,7 +587,7 @@ func (e *Enforcer) invalidateMatcherMap() {
}

// enforce use a custom matcher to decides whether a "subject" can access a "object" with the operation "action", input parameters are usually: (matcher, sub, obj, act), use model matcher by default when matcher is "".
func (e *Enforcer) enforce(matcher string, explains *[]string, rvals ...interface{}) (ok bool, err error) {
func (e *Enforcer) enforce(matcher string, explains *[]string, rvals ...interface{}) (ok bool, err error) { //nolint:funlen,cyclop,gocyclo // TODO: reduce function complexity
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("panic: %v\n%s", r, debug.Stack())
Expand Down Expand Up @@ -694,7 +695,7 @@ func (e *Enforcer) enforce(matcher string, explains *[]string, rvals ...interfac
var effect effector.Effect
var explainIndex int

if policyLen := len(e.model["p"][pType].Policy); policyLen != 0 && strings.Contains(expString, pType+"_") {
if policyLen := len(e.model["p"][pType].Policy); policyLen != 0 && strings.Contains(expString, pType+"_") { //nolint:nestif // TODO: reduce function complexity
policyEffects = make([]effector.Effect, policyLen)
matcherResults = make([]float64, policyLen)

Expand Down
4 changes: 2 additions & 2 deletions enforcer_distributed.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func NewDistributedEnforcer(params ...interface{}) (*DistributedEnforcer, error)
}

// SetDispatcher sets the current dispatcher.
func (e *DistributedEnforcer) SetDispatcher(dispatcher persist.Dispatcher) {
e.dispatcher = dispatcher
func (d *DistributedEnforcer) SetDispatcher(dispatcher persist.Dispatcher) {
d.dispatcher = dispatcher
}

// AddPoliciesSelf provides a method for dispatcher to add authorization rules to the current policy.
Expand Down
26 changes: 13 additions & 13 deletions frontend_old_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ func TestCasbinJsGetPermissionForUserOld(t *testing.T) {
if err != nil {
panic(err)
}
target_str, _ := CasbinJsGetPermissionForUserOld(e, "alice")
t.Log("GetPermissionForUser Alice", string(target_str))
alice_target := make(map[string][]string)
err = json.Unmarshal(target_str, &alice_target)
targetStr, _ := CasbinJsGetPermissionForUserOld(e, "alice")
t.Log("GetPermissionForUser Alice", string(targetStr))
aliceTarget := make(map[string][]string)
err = json.Unmarshal(targetStr, &aliceTarget)
if err != nil {
t.Errorf("Test error: %s", err)
}
perm, ok := alice_target["read"]
perm, ok := aliceTarget["read"]
if !ok {
t.Errorf("Test error: Alice doesn't have read permission")
}
Expand All @@ -50,7 +50,7 @@ func TestCasbinJsGetPermissionForUserOld(t *testing.T) {
if !contains(perm, "data2") {
t.Errorf("Test error: Alice cannot read data2")
}
perm, ok = alice_target["write"]
perm, ok = aliceTarget["write"]
if !ok {
t.Errorf("Test error: Alice doesn't have write permission")
}
Expand All @@ -61,18 +61,18 @@ func TestCasbinJsGetPermissionForUserOld(t *testing.T) {
t.Errorf("Test error: Alice cannot write data2")
}

target_str, _ = CasbinJsGetPermissionForUserOld(e, "bob")
t.Log("GetPermissionForUser Bob", string(target_str))
bob_target := make(map[string][]string)
err = json.Unmarshal(target_str, &bob_target)
targetStr, _ = CasbinJsGetPermissionForUserOld(e, "bob")
t.Log("GetPermissionForUser Bob", string(targetStr))
bobTarget := make(map[string][]string)
err = json.Unmarshal(targetStr, &bobTarget)
if err != nil {
t.Errorf("Test error: %s", err)
}
_, ok = bob_target["read"]
_, ok = bobTarget["read"]
if ok {
t.Errorf("Test error: Bob has read permission")
}
perm, ok = bob_target["write"]
perm, ok = bobTarget["write"]
if !ok {
t.Errorf("Test error: Bob doesn't have permission")
}
Expand All @@ -86,7 +86,7 @@ func TestCasbinJsGetPermissionForUserOld(t *testing.T) {
t.Errorf("Test error: Bob can access a non-existing data")
}

_, ok = bob_target["rm_rf"]
_, ok = bobTarget["rm_rf"]
if ok {
t.Errorf("Someone can have a non-existing action (rm -rf)")
}
Expand Down
10 changes: 3 additions & 7 deletions model/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,11 @@ func (model Model) AddPolicy(sec string, ptype string, rule []string) {
i := len(assertion.Policy) - 1
for ; i > 0; i-- {
idx, err := strconv.Atoi(assertion.Policy[i-1][assertion.FieldIndexMap[constant.PriorityIndex]])
if err != nil {
break
}
if idx > idxInsert {
assertion.Policy[i] = assertion.Policy[i-1]
assertion.PolicyMap[strings.Join(assertion.Policy[i-1], DefaultSep)]++
} else {
if err != nil || idx <= idxInsert {
break
}
assertion.Policy[i] = assertion.Policy[i-1]
assertion.PolicyMap[strings.Join(assertion.Policy[i-1], DefaultSep)]++
}
assertion.Policy[i] = rule
assertion.PolicyMap[strings.Join(rule, DefaultSep)] = i
Expand Down
27 changes: 14 additions & 13 deletions rbac_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,20 +315,21 @@ func (e *Enforcer) GetNamedImplicitPermissionsForUser(ptype string, user string,
if matched {
permission = append(permission, deepCopyPolicy(rule))
}
} else if len(domain) > 1 {
continue
}
if len(domain) > 1 {
return nil, errors.ErrDomainParameter
} else {
d := domain[0]
matched := rm.Match(d, rule[domainIndex])
if !matched {
continue
}
matched, _ = rm.HasLink(user, rule[0], d)
if matched {
newRule := deepCopyPolicy(rule)
newRule[domainIndex] = d
permission = append(permission, newRule)
}
}
d := domain[0]
matched := rm.Match(d, rule[domainIndex])
if !matched {
continue
}
matched, _ = rm.HasLink(user, rule[0], d)
if matched {
newRule := deepCopyPolicy(rule)
newRule[domainIndex] = d
permission = append(permission, newRule)
}
}
return permission, nil
Expand Down

1 comment on commit c929fd5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: c929fd5 Previous: 2f7619f Ratio
BenchmarkCachedRaw 17.52 ns/op 0 B/op 0 allocs/op 17.53 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkCachedRaw - ns/op 17.52 ns/op 17.53 ns/op 1.00
BenchmarkCachedRaw - B/op 0 B/op 0 B/op 1
BenchmarkCachedRaw - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkCachedBasicModel 168.1 ns/op 104 B/op 4 allocs/op 172.8 ns/op 104 B/op 4 allocs/op 0.97
BenchmarkCachedBasicModel - ns/op 168.1 ns/op 172.8 ns/op 0.97
BenchmarkCachedBasicModel - B/op 104 B/op 104 B/op 1
BenchmarkCachedBasicModel - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedRBACModel 168.2 ns/op 104 B/op 4 allocs/op 172.9 ns/op 104 B/op 4 allocs/op 0.97
BenchmarkCachedRBACModel - ns/op 168.2 ns/op 172.9 ns/op 0.97
BenchmarkCachedRBACModel - B/op 104 B/op 104 B/op 1
BenchmarkCachedRBACModel - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedRBACModelSmall 180.5 ns/op 104 B/op 4 allocs/op 183.2 ns/op 104 B/op 4 allocs/op 0.99
BenchmarkCachedRBACModelSmall - ns/op 180.5 ns/op 183.2 ns/op 0.99
BenchmarkCachedRBACModelSmall - B/op 104 B/op 104 B/op 1
BenchmarkCachedRBACModelSmall - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedRBACModelMedium 181.9 ns/op 104 B/op 4 allocs/op 188.9 ns/op 104 B/op 4 allocs/op 0.96
BenchmarkCachedRBACModelMedium - ns/op 181.9 ns/op 188.9 ns/op 0.96
BenchmarkCachedRBACModelMedium - B/op 104 B/op 104 B/op 1
BenchmarkCachedRBACModelMedium - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedRBACModelLarge 169.1 ns/op 96 B/op 3 allocs/op 174.2 ns/op 96 B/op 3 allocs/op 0.97
BenchmarkCachedRBACModelLarge - ns/op 169.1 ns/op 174.2 ns/op 0.97
BenchmarkCachedRBACModelLarge - B/op 96 B/op 96 B/op 1
BenchmarkCachedRBACModelLarge - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkCachedRBACModelWithResourceRoles 171 ns/op 104 B/op 4 allocs/op 172.7 ns/op 104 B/op 4 allocs/op 0.99
BenchmarkCachedRBACModelWithResourceRoles - ns/op 171 ns/op 172.7 ns/op 0.99
BenchmarkCachedRBACModelWithResourceRoles - B/op 104 B/op 104 B/op 1
BenchmarkCachedRBACModelWithResourceRoles - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedRBACModelWithDomains 184.6 ns/op 120 B/op 4 allocs/op 187.9 ns/op 120 B/op 4 allocs/op 0.98
BenchmarkCachedRBACModelWithDomains - ns/op 184.6 ns/op 187.9 ns/op 0.98
BenchmarkCachedRBACModelWithDomains - B/op 120 B/op 120 B/op 1
BenchmarkCachedRBACModelWithDomains - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedABACModel 2823 ns/op 1541 B/op 18 allocs/op 2899 ns/op 1547 B/op 18 allocs/op 0.97
BenchmarkCachedABACModel - ns/op 2823 ns/op 2899 ns/op 0.97
BenchmarkCachedABACModel - B/op 1541 B/op 1547 B/op 1.00
BenchmarkCachedABACModel - allocs/op 18 allocs/op 18 allocs/op 1
BenchmarkCachedKeyMatchModel 188.3 ns/op 152 B/op 4 allocs/op 196 ns/op 152 B/op 4 allocs/op 0.96
BenchmarkCachedKeyMatchModel - ns/op 188.3 ns/op 196 ns/op 0.96
BenchmarkCachedKeyMatchModel - B/op 152 B/op 152 B/op 1
BenchmarkCachedKeyMatchModel - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedRBACModelWithDeny 171.4 ns/op 104 B/op 4 allocs/op 174.1 ns/op 104 B/op 4 allocs/op 0.98
BenchmarkCachedRBACModelWithDeny - ns/op 171.4 ns/op 174.1 ns/op 0.98
BenchmarkCachedRBACModelWithDeny - B/op 104 B/op 104 B/op 1
BenchmarkCachedRBACModelWithDeny - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedPriorityModel 170.6 ns/op 104 B/op 4 allocs/op 173.4 ns/op 104 B/op 4 allocs/op 0.98
BenchmarkCachedPriorityModel - ns/op 170.6 ns/op 173.4 ns/op 0.98
BenchmarkCachedPriorityModel - B/op 104 B/op 104 B/op 1
BenchmarkCachedPriorityModel - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkCachedWithEnforceContext 305.3 ns/op 240 B/op 5 allocs/op 309.6 ns/op 240 B/op 5 allocs/op 0.99
BenchmarkCachedWithEnforceContext - ns/op 305.3 ns/op 309.6 ns/op 0.99
BenchmarkCachedWithEnforceContext - B/op 240 B/op 240 B/op 1
BenchmarkCachedWithEnforceContext - allocs/op 5 allocs/op 5 allocs/op 1
BenchmarkCachedRBACModelMediumParallel 180.6 ns/op 106 B/op 4 allocs/op 171.5 ns/op 106 B/op 4 allocs/op 1.05
BenchmarkCachedRBACModelMediumParallel - ns/op 180.6 ns/op 171.5 ns/op 1.05
BenchmarkCachedRBACModelMediumParallel - B/op 106 B/op 106 B/op 1
BenchmarkCachedRBACModelMediumParallel - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkHasPolicySmall 460.1 ns/op 150 B/op 6 allocs/op 464.3 ns/op 150 B/op 6 allocs/op 0.99
BenchmarkHasPolicySmall - ns/op 460.1 ns/op 464.3 ns/op 0.99
BenchmarkHasPolicySmall - B/op 150 B/op 150 B/op 1
BenchmarkHasPolicySmall - allocs/op 6 allocs/op 6 allocs/op 1
BenchmarkHasPolicyMedium 502.6 ns/op 157 B/op 6 allocs/op 488 ns/op 157 B/op 6 allocs/op 1.03
BenchmarkHasPolicyMedium - ns/op 502.6 ns/op 488 ns/op 1.03
BenchmarkHasPolicyMedium - B/op 157 B/op 157 B/op 1
BenchmarkHasPolicyMedium - allocs/op 6 allocs/op 6 allocs/op 1
BenchmarkHasPolicyLarge 520.3 ns/op 165 B/op 7 allocs/op 526.3 ns/op 165 B/op 7 allocs/op 0.99
BenchmarkHasPolicyLarge - ns/op 520.3 ns/op 526.3 ns/op 0.99
BenchmarkHasPolicyLarge - B/op 165 B/op 165 B/op 1
BenchmarkHasPolicyLarge - allocs/op 7 allocs/op 7 allocs/op 1
BenchmarkAddPolicySmall 486.7 ns/op 152 B/op 6 allocs/op 479.3 ns/op 152 B/op 6 allocs/op 1.02
BenchmarkAddPolicySmall - ns/op 486.7 ns/op 479.3 ns/op 1.02
BenchmarkAddPolicySmall - B/op 152 B/op 152 B/op 1
BenchmarkAddPolicySmall - allocs/op 6 allocs/op 6 allocs/op 1
BenchmarkAddPolicyMedium 569.7 ns/op 175 B/op 7 allocs/op 579.5 ns/op 176 B/op 7 allocs/op 0.98
BenchmarkAddPolicyMedium - ns/op 569.7 ns/op 579.5 ns/op 0.98
BenchmarkAddPolicyMedium - B/op 175 B/op 176 B/op 0.99
BenchmarkAddPolicyMedium - allocs/op 7 allocs/op 7 allocs/op 1
BenchmarkAddPolicyLarge 1126 ns/op 470 B/op 9 allocs/op 1117 ns/op 470 B/op 9 allocs/op 1.01
BenchmarkAddPolicyLarge - ns/op 1126 ns/op 1117 ns/op 1.01
BenchmarkAddPolicyLarge - B/op 470 B/op 470 B/op 1
BenchmarkAddPolicyLarge - allocs/op 9 allocs/op 9 allocs/op 1
BenchmarkRemovePolicySmall 498.3 ns/op 166 B/op 7 allocs/op 500 ns/op 166 B/op 7 allocs/op 1.00
BenchmarkRemovePolicySmall - ns/op 498.3 ns/op 500 ns/op 1.00
BenchmarkRemovePolicySmall - B/op 166 B/op 166 B/op 1
BenchmarkRemovePolicySmall - allocs/op 7 allocs/op 7 allocs/op 1
BenchmarkRemovePolicyMedium 561.7 ns/op 176 B/op 7 allocs/op 550 ns/op 177 B/op 7 allocs/op 1.02
BenchmarkRemovePolicyMedium - ns/op 561.7 ns/op 550 ns/op 1.02
BenchmarkRemovePolicyMedium - B/op 176 B/op 177 B/op 0.99
BenchmarkRemovePolicyMedium - allocs/op 7 allocs/op 7 allocs/op 1
BenchmarkRemovePolicyLarge 1267 ns/op 286 B/op 13 allocs/op 1220 ns/op 290 B/op 13 allocs/op 1.04
BenchmarkRemovePolicyLarge - ns/op 1267 ns/op 1220 ns/op 1.04
BenchmarkRemovePolicyLarge - B/op 286 B/op 290 B/op 0.99
BenchmarkRemovePolicyLarge - allocs/op 13 allocs/op 13 allocs/op 1
BenchmarkRaw 17.52 ns/op 0 B/op 0 allocs/op 17.57 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkRaw - ns/op 17.52 ns/op 17.57 ns/op 1.00
BenchmarkRaw - B/op 0 B/op 0 B/op 1
BenchmarkRaw - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkBasicModel 3584 ns/op 1508 B/op 17 allocs/op 3589 ns/op 1510 B/op 17 allocs/op 1.00
BenchmarkBasicModel - ns/op 3584 ns/op 3589 ns/op 1.00
BenchmarkBasicModel - B/op 1508 B/op 1510 B/op 1.00
BenchmarkBasicModel - allocs/op 17 allocs/op 17 allocs/op 1
BenchmarkRBACModel 5446 ns/op 2063 B/op 35 allocs/op 5396 ns/op 2070 B/op 35 allocs/op 1.01
BenchmarkRBACModel - ns/op 5446 ns/op 5396 ns/op 1.01
BenchmarkRBACModel - B/op 2063 B/op 2070 B/op 1.00
BenchmarkRBACModel - allocs/op 35 allocs/op 35 allocs/op 1
BenchmarkRBACModelSizes/small 49942 ns/op 20295 B/op 480 allocs/op 48323 ns/op 20152 B/op 480 allocs/op 1.03
BenchmarkRBACModelSizes/small - ns/op 49942 ns/op 48323 ns/op 1.03
BenchmarkRBACModelSizes/small - B/op 20295 B/op 20152 B/op 1.01
BenchmarkRBACModelSizes/small - allocs/op 480 allocs/op 480 allocs/op 1
BenchmarkRBACModelSizes/medium 498616 ns/op 191710 B/op 4827 allocs/op 505645 ns/op 191342 B/op 4829 allocs/op 0.99
BenchmarkRBACModelSizes/medium - ns/op 498616 ns/op 505645 ns/op 0.99
BenchmarkRBACModelSizes/medium - B/op 191710 B/op 191342 B/op 1.00
BenchmarkRBACModelSizes/medium - allocs/op 4827 allocs/op 4829 allocs/op 1.00
BenchmarkRBACModelSizes/large 5454385 ns/op 1902766 B/op 48265 allocs/op 5295330 ns/op 1895942 B/op 48061 allocs/op 1.03
BenchmarkRBACModelSizes/large - ns/op 5454385 ns/op 5295330 ns/op 1.03
BenchmarkRBACModelSizes/large - B/op 1902766 B/op 1895942 B/op 1.00
BenchmarkRBACModelSizes/large - allocs/op 48265 allocs/op 48061 allocs/op 1.00
BenchmarkRBACModelSmall 61840 ns/op 20426 B/op 615 allocs/op 57864 ns/op 20206 B/op 615 allocs/op 1.07
BenchmarkRBACModelSmall - ns/op 61840 ns/op 57864 ns/op 1.07
BenchmarkRBACModelSmall - B/op 20426 B/op 20206 B/op 1.01
BenchmarkRBACModelSmall - allocs/op 615 allocs/op 615 allocs/op 1
BenchmarkRBACModelMedium 585722 ns/op 194746 B/op 6021 allocs/op 566602 ns/op 194271 B/op 6020 allocs/op 1.03
BenchmarkRBACModelMedium - ns/op 585722 ns/op 566602 ns/op 1.03
BenchmarkRBACModelMedium - B/op 194746 B/op 194271 B/op 1.00
BenchmarkRBACModelMedium - allocs/op 6021 allocs/op 6020 allocs/op 1.00
BenchmarkRBACModelLarge 6077619 ns/op 1940311 B/op 60595 allocs/op 6072450 ns/op 1939957 B/op 60589 allocs/op 1.00
BenchmarkRBACModelLarge - ns/op 6077619 ns/op 6072450 ns/op 1.00
BenchmarkRBACModelLarge - B/op 1940311 B/op 1939957 B/op 1.00
BenchmarkRBACModelLarge - allocs/op 60595 allocs/op 60589 allocs/op 1.00
BenchmarkRBACModelWithResourceRoles 5164 ns/op 2736 B/op 28 allocs/op 5179 ns/op 2728 B/op 28 allocs/op 1.00
BenchmarkRBACModelWithResourceRoles - ns/op 5164 ns/op 5179 ns/op 1.00
BenchmarkRBACModelWithResourceRoles - B/op 2736 B/op 2728 B/op 1.00
BenchmarkRBACModelWithResourceRoles - allocs/op 28 allocs/op 28 allocs/op 1
BenchmarkRBACModelWithDomains 5139 ns/op 1826 B/op 25 allocs/op 5138 ns/op 1828 B/op 25 allocs/op 1.00
BenchmarkRBACModelWithDomains - ns/op 5139 ns/op 5138 ns/op 1.00
BenchmarkRBACModelWithDomains - B/op 1826 B/op 1828 B/op 1.00
BenchmarkRBACModelWithDomains - allocs/op 25 allocs/op 25 allocs/op 1
BenchmarkABACModel 2724 ns/op 1535 B/op 17 allocs/op 2771 ns/op 1532 B/op 17 allocs/op 0.98
BenchmarkABACModel - ns/op 2724 ns/op 2771 ns/op 0.98
BenchmarkABACModel - B/op 1535 B/op 1532 B/op 1.00
BenchmarkABACModel - allocs/op 17 allocs/op 17 allocs/op 1
BenchmarkABACRuleModel 3955015 ns/op 1329244 B/op 40092 allocs/op 3843048 ns/op 1321368 B/op 40091 allocs/op 1.03
BenchmarkABACRuleModel - ns/op 3955015 ns/op 3843048 ns/op 1.03
BenchmarkABACRuleModel - B/op 1329244 B/op 1321368 B/op 1.01
BenchmarkABACRuleModel - allocs/op 40092 allocs/op 40091 allocs/op 1.00
BenchmarkKeyMatchModel 5930 ns/op 3063 B/op 37 allocs/op 6021 ns/op 3065 B/op 37 allocs/op 0.98
BenchmarkKeyMatchModel - ns/op 5930 ns/op 6021 ns/op 0.98
BenchmarkKeyMatchModel - B/op 3063 B/op 3065 B/op 1.00
BenchmarkKeyMatchModel - allocs/op 37 allocs/op 37 allocs/op 1
BenchmarkRBACModelWithDeny 6883 ns/op 2480 B/op 49 allocs/op 6896 ns/op 2476 B/op 49 allocs/op 1.00
BenchmarkRBACModelWithDeny - ns/op 6883 ns/op 6896 ns/op 1.00
BenchmarkRBACModelWithDeny - B/op 2480 B/op 2476 B/op 1.00
BenchmarkRBACModelWithDeny - allocs/op 49 allocs/op 49 allocs/op 1
BenchmarkPriorityModel 4108 ns/op 1760 B/op 22 allocs/op 4200 ns/op 1763 B/op 22 allocs/op 0.98
BenchmarkPriorityModel - ns/op 4108 ns/op 4200 ns/op 0.98
BenchmarkPriorityModel - B/op 1760 B/op 1763 B/op 1.00
BenchmarkPriorityModel - allocs/op 22 allocs/op 22 allocs/op 1
BenchmarkRBACModelWithDomainPatternLarge 22589 ns/op 16724 B/op 164 allocs/op 22604 ns/op 16707 B/op 164 allocs/op 1.00
BenchmarkRBACModelWithDomainPatternLarge - ns/op 22589 ns/op 22604 ns/op 1.00
BenchmarkRBACModelWithDomainPatternLarge - B/op 16724 B/op 16707 B/op 1.00
BenchmarkRBACModelWithDomainPatternLarge - allocs/op 164 allocs/op 164 allocs/op 1
BenchmarkRoleManagerSmall 67850 ns/op 11955 B/op 797 allocs/op 66702 ns/op 11954 B/op 797 allocs/op 1.02
BenchmarkRoleManagerSmall - ns/op 67850 ns/op 66702 ns/op 1.02
BenchmarkRoleManagerSmall - B/op 11955 B/op 11954 B/op 1.00
BenchmarkRoleManagerSmall - allocs/op 797 allocs/op 797 allocs/op 1
BenchmarkRoleManagerMedium 716473 ns/op 125915 B/op 8741 allocs/op 702469 ns/op 125914 B/op 8741 allocs/op 1.02
BenchmarkRoleManagerMedium - ns/op 716473 ns/op 702469 ns/op 1.02
BenchmarkRoleManagerMedium - B/op 125915 B/op 125914 B/op 1.00
BenchmarkRoleManagerMedium - allocs/op 8741 allocs/op 8741 allocs/op 1
BenchmarkRoleManagerLarge 7521004 ns/op 1349923 B/op 89741 allocs/op 7711008 ns/op 1349925 B/op 89741 allocs/op 0.98
BenchmarkRoleManagerLarge - ns/op 7521004 ns/op 7711008 ns/op 0.98
BenchmarkRoleManagerLarge - B/op 1349923 B/op 1349925 B/op 1.00
BenchmarkRoleManagerLarge - allocs/op 89741 allocs/op 89741 allocs/op 1
BenchmarkBuildRoleLinksWithPatternLarge 6041007016 ns/op 5344877360 B/op 60949265 allocs/op 5811966746 ns/op 5328455512 B/op 60945371 allocs/op 1.04
BenchmarkBuildRoleLinksWithPatternLarge - ns/op 6041007016 ns/op 5811966746 ns/op 1.04
BenchmarkBuildRoleLinksWithPatternLarge - B/op 5344877360 B/op 5328455512 B/op 1.00
BenchmarkBuildRoleLinksWithPatternLarge - allocs/op 60949265 allocs/op 60945371 allocs/op 1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge 166841987 ns/op 141651934 B/op 1676512 allocs/op 164412824 ns/op 141728643 B/op 1676514 allocs/op 1.01
BenchmarkBuildRoleLinksWithDomainPatternLarge - ns/op 166841987 ns/op 164412824 ns/op 1.01
BenchmarkBuildRoleLinksWithDomainPatternLarge - B/op 141651934 B/op 141728643 B/op 1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge - allocs/op 1676512 allocs/op 1676514 allocs/op 1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge 6276031932 ns/op 5484715584 B/op 62560400 allocs/op 6240346242 ns/op 5489362736 B/op 62560690 allocs/op 1.01
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - ns/op 6276031932 ns/op 6240346242 ns/op 1.01
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - B/op 5484715584 B/op 5489362736 B/op 1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - allocs/op 62560400 allocs/op 62560690 allocs/op 1.00
BenchmarkHasLinkWithPatternLarge 10247 ns/op 7609 B/op 111 allocs/op 10273 ns/op 7593 B/op 111 allocs/op 1.00
BenchmarkHasLinkWithPatternLarge - ns/op 10247 ns/op 10273 ns/op 1.00
BenchmarkHasLinkWithPatternLarge - B/op 7609 B/op 7593 B/op 1.00
BenchmarkHasLinkWithPatternLarge - allocs/op 111 allocs/op 111 allocs/op 1
BenchmarkHasLinkWithDomainPatternLarge 475.9 ns/op 80 B/op 5 allocs/op 476.5 ns/op 80 B/op 5 allocs/op 1.00
BenchmarkHasLinkWithDomainPatternLarge - ns/op 475.9 ns/op 476.5 ns/op 1.00
BenchmarkHasLinkWithDomainPatternLarge - B/op 80 B/op 80 B/op 1
BenchmarkHasLinkWithDomainPatternLarge - allocs/op 5 allocs/op 5 allocs/op 1
BenchmarkHasLinkWithPatternAndDomainPatternLarge 10174 ns/op 7600 B/op 111 allocs/op 9946 ns/op 7586 B/op 111 allocs/op 1.02
BenchmarkHasLinkWithPatternAndDomainPatternLarge - ns/op 10174 ns/op 9946 ns/op 1.02
BenchmarkHasLinkWithPatternAndDomainPatternLarge - B/op 7600 B/op 7586 B/op 1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - allocs/op 111 allocs/op 111 allocs/op 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.