up lint
This commit is contained in:
1 parent
b692728cc3
commit
59875487ae
7 files changed
+13
-7
No files matched your search
@@ -19,6 +19,8 @@ linters:
|
||||
- varnamelen # очень индивидуально (db)
|
||||
- wsl # расставление пробелов очень индивидуально
|
||||
- wsl_v5 # расставление пробелов очень индивидуально
|
||||
- godoclint # ругается на // nolint, не удобно
|
||||
- prealloc # слишком аггресивный, в большинстве случаев не требуется
|
||||
settings:
|
||||
cyclop:
|
||||
max-complexity: 15 # по умолчанию 10 мало
|
||||
@@ -55,6 +57,10 @@ linters:
|
||||
- linters:
|
||||
- wrapcheck
|
||||
path: transaction # транзакции прозрачны
|
||||
- linters:
|
||||
- unqueryvet
|
||||
- prealloc
|
||||
path: ".*_test\\.go$"
|
||||
- linters:
|
||||
- wrapcheck
|
||||
path: middleware #отсутствует необходимость оборачивать ошибки
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
||||
func init() {
|
||||
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) {
|
||||
t.Type = "string"
|
||||
t.Enum = []interface{}{"debug", "info", "warn", "error", "fatal"}
|
||||
t.Enum = []any{"debug", "info", "warn", "error", "fatal"}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// nolint:mnd
|
||||
// nolint:mnd,gosec
|
||||
package helpers
|
||||
|
||||
import (
|
||||
|
||||
@@ -28,7 +28,7 @@ func (e *HttpError) Error() string {
|
||||
func (e *HttpError) WriteError(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(e.statusCode)
|
||||
data := map[string]interface{}{
|
||||
data := map[string]any{
|
||||
"errorCode": http.StatusText(e.statusCode),
|
||||
"errorMessage": e.userMessage,
|
||||
"details": e.details,
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ func (p Grpc) handleError(err error, w http.ResponseWriter, endpoint string) err
|
||||
)
|
||||
}
|
||||
|
||||
func (p Grpc) writeProto(statusCode int, proto interface{}, w http.ResponseWriter) error {
|
||||
func (p Grpc) writeProto(statusCode int, proto any, w http.ResponseWriter) error {
|
||||
data, err := json.Marshal(proto)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "marshal grpc details to json")
|
||||
|
||||
+1
-1
@@ -115,4 +115,4 @@ func (s *Routes) registerEndpoint(
|
||||
*r = *r.WithContext(ctx)
|
||||
}
|
||||
router.Handle(httpMethod, path, handler)
|
||||
}
|
||||
}
|
||||
@@ -126,11 +126,11 @@ func NewMock(logger log.Logger) (*MockServer, *client.Client, *client.Client) {
|
||||
return &MockServer{
|
||||
srv: srv,
|
||||
logger: logger,
|
||||
mockEndpoints: make(map[string]interface{}),
|
||||
mockEndpoints: make(map[string]any),
|
||||
}, syscli, admincli
|
||||
}
|
||||
|
||||
func (m *MockServer) Mock(endpoint string, handler interface{}) *MockServer {
|
||||
func (m *MockServer) Mock(endpoint string, handler any) *MockServer {
|
||||
m.mockEndpoints[endpoint] = handler
|
||||
wrapper := endpoint2.DefaultWrapper(m.logger)
|
||||
muxer := grpc.NewMux()
|
||||
|
||||
Reference in new issue
Block a user