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