forked from TrueCloudLab/policy-engine
[#14] pre-commit: Add gofumpt
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
8dc9d9fa58
commit
5eee1a7334
3 changed files with 4 additions and 2 deletions
|
@ -47,7 +47,7 @@ linters:
|
||||||
- durationcheck
|
- durationcheck
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- exportloopref
|
- exportloopref
|
||||||
- gofmt
|
- gofumpt
|
||||||
- goimports
|
- goimports
|
||||||
- misspell
|
- misspell
|
||||||
- whitespace
|
- whitespace
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -12,7 +12,7 @@ fmts: fmt imports
|
||||||
# Reformat code
|
# Reformat code
|
||||||
fmt:
|
fmt:
|
||||||
@echo "⇒ Processing gofmt check"
|
@echo "⇒ Processing gofmt check"
|
||||||
@gofmt -s -w .
|
@gofumpt -s -w .
|
||||||
|
|
||||||
# Reformat imports
|
# Reformat imports
|
||||||
imports:
|
imports:
|
||||||
|
|
2
chain.go
2
chain.go
|
@ -150,6 +150,7 @@ func (r *Rule) matchCondition(obj Request) (status Status, matched bool) {
|
||||||
}
|
}
|
||||||
return r.matchAll(obj)
|
return r.matchAll(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Rule) matchAny(obj Request) (status Status, matched bool) {
|
func (r *Rule) matchAny(obj Request) (status Status, matched bool) {
|
||||||
for i := range r.Condition {
|
for i := range r.Condition {
|
||||||
if r.Condition[i].Match(obj) {
|
if r.Condition[i].Match(obj) {
|
||||||
|
@ -158,6 +159,7 @@ func (r *Rule) matchAny(obj Request) (status Status, matched bool) {
|
||||||
}
|
}
|
||||||
return NoRuleFound, false
|
return NoRuleFound, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Rule) matchAll(obj Request) (status Status, matched bool) {
|
func (r *Rule) matchAll(obj Request) (status Status, matched bool) {
|
||||||
for i := range r.Condition {
|
for i := range r.Condition {
|
||||||
if !r.Condition[i].Match(obj) {
|
if !r.Condition[i].Match(obj) {
|
||||||
|
|
Loading…
Reference in a new issue