mirror of
https://github.com/foomo/keel.git
synced 2025-10-16 12:35:34 +00:00
chore: linting
This commit is contained in:
parent
54b4154426
commit
661f16e550
@ -8,5 +8,5 @@ indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{yaml,yml}]
|
||||
[*.{yaml,yml,md,mdx}]
|
||||
indent_style = space
|
||||
|
||||
2
.github/workflows/checks.yml
vendored
2
.github/workflows/checks.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
run: |
|
||||
matrix=$(find . -type f -name "go.mod" -printf "{\"folder\":\"%h\"}," | sed -e 's/,$//')
|
||||
echo "Matrix: $matrix"
|
||||
echo ::set-output name=matrix::{\"include\":[$(echo $matrix)]}
|
||||
echo "::set-output name=matrix::{\"include\":[$matrix]}"
|
||||
go_lint:
|
||||
name: go lint
|
||||
needs: go_matrix
|
||||
|
||||
@ -30,7 +30,6 @@ linters:
|
||||
- bodyclose
|
||||
- dogsled
|
||||
- dupl
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- gci
|
||||
- goconst
|
||||
|
||||
16
Makefile
16
Makefile
@ -16,24 +16,30 @@ check: test lint
|
||||
test:
|
||||
gotestsum --format short-verbose ./...
|
||||
|
||||
lint%:files=$(shell find . -type f -name go.mod)
|
||||
lint%:dirs=$(foreach file,$(files),$(dir $(file)) )
|
||||
|
||||
.PHONY: lint
|
||||
## Run linter
|
||||
lint:
|
||||
golangci-lint run
|
||||
@for dir in $(dirs); do cd $$dir && golangci-lint run; done
|
||||
|
||||
.PHONY: lint.fix
|
||||
## Fix lint violations
|
||||
lint.fix:
|
||||
golangci-lint run --fix
|
||||
@for dir in $(dirs); do cd $$dir && golangci-lint run --fix; done
|
||||
|
||||
.PHONY: lint.super
|
||||
## Run super linter
|
||||
lint.super:
|
||||
docker run --rm -it \
|
||||
-e 'RUN_LOCAL=true' \
|
||||
-e 'VALIDATE_ALL_CODEBASE=true' \
|
||||
-e 'VALIDATE_GO=true' \
|
||||
-e 'VALIDATE_GITHUB_ACTIONS=true' \
|
||||
-e 'DEFAULT_BRANCH=main' \
|
||||
-e 'IGNORE_GITIGNORED_FILES=true' \
|
||||
-e 'VALIDATE_SHELL_SHFMT=false' \
|
||||
-e 'VALIDATE_JSCPD=false' \
|
||||
-e 'VALIDATE_BASH=false' \
|
||||
-e 'VALIDATE_GO=false' \
|
||||
-v $(PWD):/tmp/lint \
|
||||
github/super-linter
|
||||
|
||||
|
||||
38
README.md
38
README.md
@ -22,36 +22,36 @@ See the examples folder for usages
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http"
|
||||
|
||||
"github.com/foomo/keel"
|
||||
"github.com/foomo/keel"
|
||||
)
|
||||
|
||||
func main() {
|
||||
svr := keel.NewServer(
|
||||
keel.WithHTTPZapService(true),
|
||||
keel.WithHTTPViperService(true),
|
||||
keel.WithHTTPPrometheusService(true),
|
||||
)
|
||||
svr := keel.NewServer(
|
||||
keel.WithHTTPZapService(true),
|
||||
keel.WithHTTPViperService(true),
|
||||
keel.WithHTTPPrometheusService(true),
|
||||
)
|
||||
|
||||
l := svr.Logger()
|
||||
l := svr.Logger()
|
||||
|
||||
svs := newService()
|
||||
svs := newService()
|
||||
|
||||
svr.AddService(
|
||||
keel.NewServiceHTTP(l, "demo", ":8080", svs),
|
||||
)
|
||||
svr.AddService(
|
||||
keel.NewServiceHTTP(l, "demo", ":8080", svs),
|
||||
)
|
||||
|
||||
svr.Run()
|
||||
svr.Run()
|
||||
}
|
||||
|
||||
func newService() *http.ServeMux {
|
||||
s := http.NewServeMux()
|
||||
s.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write([]byte("OK"))
|
||||
})
|
||||
return s
|
||||
s := http.NewServeMux()
|
||||
s.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write([]byte("OK"))
|
||||
})
|
||||
return s
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -37,4 +37,3 @@ func main() {
|
||||
|
||||
svr.Run()
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
||||
@ -12,8 +13,6 @@ import (
|
||||
"github.com/foomo/keel/example/persistence/mongo/store"
|
||||
"github.com/foomo/keel/log"
|
||||
keelmongo "github.com/foomo/keel/persistence/mongo"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// docker run -it --rm -p 27017:27017 mongo
|
||||
|
||||
@ -2,7 +2,6 @@ package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
||||
@ -11,8 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type DummyRepository struct {
|
||||
collection *keelmongo.Collection
|
||||
upsertMutex sync.Mutex
|
||||
collection *keelmongo.Collection
|
||||
}
|
||||
|
||||
// NewDummyRepository constructor
|
||||
|
||||
@ -34,8 +34,7 @@ func (d *DateTimeCodec) DecodeValue(_ bsoncodec.DecodeContext, vr bsonrw.ValueRe
|
||||
}
|
||||
|
||||
var dateTimeVal DateTime
|
||||
valueType := vr.Type()
|
||||
switch valueType {
|
||||
switch t := vr.Type(); t {
|
||||
case bsontype.DateTime:
|
||||
dt, err := vr.ReadDateTime()
|
||||
if err != nil {
|
||||
@ -49,7 +48,7 @@ func (d *DateTimeCodec) DecodeValue(_ bsoncodec.DecodeContext, vr bsonrw.ValueRe
|
||||
}
|
||||
dateTimeVal = DateTime(decimalStr)
|
||||
default:
|
||||
return fmt.Errorf("cannot decode %v into a DateTime", valueType)
|
||||
return fmt.Errorf("cannot decode %v into a DateTime", t)
|
||||
}
|
||||
|
||||
val.Set(reflect.ValueOf(dateTimeVal))
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package jetstream
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package jetstream
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
@ -25,7 +25,7 @@ func main() {
|
||||
// enable trace output (default: false)
|
||||
// OTEL_EXPORTER_STDOUT_TRACE_ENABLED="true"
|
||||
//
|
||||
// pretty print ouput (default: true)
|
||||
// pretty print output (default: true)
|
||||
// OTEL_EXPORTER_STDOUT_PRETTY_PRINT="true"
|
||||
//
|
||||
// disable host metrics (default: true)
|
||||
|
||||
51413
super-linter.log
51413
super-linter.log
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user