mirror of
https://github.com/go-kratos/kratos.git
synced 2025-11-06 08:59:18 +02:00
fix: ci lint error (#1391)
* fix lint check * fix lll lint error * fix build error * fix gomnd * fix shadow declaration * add make test command * update
This commit is contained in:
@@ -73,7 +73,7 @@ func Errorf(code int, reason, format string, a ...interface{}) error {
|
||||
// It supports wrapped errors.
|
||||
func Code(err error) int {
|
||||
if err == nil {
|
||||
return 200
|
||||
return 200 //nolint:gomnd
|
||||
}
|
||||
if se := FromError(err); se != nil {
|
||||
return int(se.Code)
|
||||
|
||||
@@ -8,9 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestError(t *testing.T) {
|
||||
var (
|
||||
base *Error
|
||||
)
|
||||
var base *Error
|
||||
err := Newf(http.StatusBadRequest, "reason", "message")
|
||||
err2 := Newf(http.StatusBadRequest, "reason", "message")
|
||||
err3 := err.WithMetadata(map[string]string{
|
||||
@@ -45,7 +43,7 @@ func TestError(t *testing.T) {
|
||||
|
||||
gs := err.GRPCStatus()
|
||||
se := FromError(gs.Err())
|
||||
if se.Reason != se.Reason {
|
||||
if se.Reason != "reason" {
|
||||
t.Errorf("got %+v want %+v", se, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// nolint:gomnd
|
||||
package errors
|
||||
|
||||
// BadRequest new BadRequest error that is mapped to a 400 response.
|
||||
|
||||
Reference in New Issue
Block a user