fix: lint errors

This commit is contained in:
Kevin Franklin Kim 2022-08-17 07:49:52 +02:00
parent 609c0067a7
commit c19ce8f1d0
3 changed files with 19 additions and 19 deletions

View File

@ -21,8 +21,8 @@ type (
)
const (
ScalarErrorOne ScalarError = "scalar error one"
ScalarErrorTwo ScalarError = "scalar error two"
ScalarErrorOne ScalarError = "scalar error one" //nolint:errname
ScalarErrorTwo ScalarError = "scalar error two" //nolint:errname
)
func NewScalarError(e ScalarError) *ScalarError {
@ -64,7 +64,7 @@ func (h *Handler) Error(w http.ResponseWriter, r *http.Request) (e error) {
return errors.New("error")
}
func (h *Handler) Scalar(w http.ResponseWriter, r *http.Request) (e *backend.Scalar) {
func (h *Handler) Scalar(w http.ResponseWriter, r *http.Request) (e *backend.ScalarError) {
s := backend.ScalarOne
return &s
}
@ -75,8 +75,8 @@ func (h *Handler) MultiScalar(w http.ResponseWriter, r *http.Request) (e *backen
}
}
func (h *Handler) Struct(w http.ResponseWriter, r *http.Request) (e *backend.Struct) {
return &backend.Struct{
func (h *Handler) Struct(w http.ResponseWriter, r *http.Request) (e *backend.StructError) {
return &backend.StructError{
Message: "my custom scalar",
Data: "hello world",
}

View File

@ -14,9 +14,9 @@ type ServiceGoTSRPCClient interface {
CustomError(ctx go_context.Context) (e error, clientErr error)
Error(ctx go_context.Context) (e error, clientErr error)
MultiScalar(ctx go_context.Context) (e *MultiScalar, clientErr error)
Scalar(ctx go_context.Context) (e *Scalar, clientErr error)
Scalar(ctx go_context.Context) (e *ScalarError, clientErr error)
ScalarError(ctx go_context.Context) (e error, clientErr error)
Struct(ctx go_context.Context) (e *Struct, clientErr error)
Struct(ctx go_context.Context) (e *StructError, clientErr error)
TypedCustomError(ctx go_context.Context) (e error, clientErr error)
TypedError(ctx go_context.Context) (e error, clientErr error)
TypedScalarError(ctx go_context.Context) (e error, clientErr error)
@ -75,7 +75,7 @@ func (tsc *HTTPServiceGoTSRPCClient) MultiScalar(ctx go_context.Context) (e *Mul
return
}
func (tsc *HTTPServiceGoTSRPCClient) Scalar(ctx go_context.Context) (e *Scalar, clientErr error) {
func (tsc *HTTPServiceGoTSRPCClient) Scalar(ctx go_context.Context) (e *ScalarError, clientErr error) {
args := []interface{}{}
reply := []interface{}{&e}
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Scalar", args, reply)
@ -95,7 +95,7 @@ func (tsc *HTTPServiceGoTSRPCClient) ScalarError(ctx go_context.Context) (e erro
return
}
func (tsc *HTTPServiceGoTSRPCClient) Struct(ctx go_context.Context) (e *Struct, clientErr error) {
func (tsc *HTTPServiceGoTSRPCClient) Struct(ctx go_context.Context) (e *StructError, clientErr error) {
args := []interface{}{}
reply := []interface{}{&e}
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Struct", args, reply)

View File

@ -10,22 +10,22 @@ const (
ErrUnauthorized ErrService = "unauthorized"
)
type Scalar string
type ScalarError string
func (s Scalar) String() string {
return string(s)
func (s *ScalarError) String() string {
return string(*s)
}
func (s *Scalar) Error() string {
func (s *ScalarError) Error() string {
return s.String()
}
type Struct struct {
type StructError struct {
Message string `json:"message"`
Data string `json:"data"`
}
func (s *Struct) Error() string {
func (s *StructError) Error() string {
return s.Message
}
@ -39,8 +39,8 @@ type (
)
const (
ScalarOne Scalar = "one"
ScalarTwo Scalar = "two"
ScalarOne ScalarError = "one" //nolint:errname
ScalarTwo ScalarError = "two" //nolint:errname
ScalarAOne ScalarA = "one"
ScalarATwo ScalarA = "two"
@ -51,9 +51,9 @@ const (
type Service interface {
Error(w http.ResponseWriter, r *http.Request) (e error)
Scalar(w http.ResponseWriter, r *http.Request) (e *Scalar)
Scalar(w http.ResponseWriter, r *http.Request) (e *ScalarError)
MultiScalar(w http.ResponseWriter, r *http.Request) (e *MultiScalar)
Struct(w http.ResponseWriter, r *http.Request) (e *Struct)
Struct(w http.ResponseWriter, r *http.Request) (e *StructError)
TypedError(w http.ResponseWriter, r *http.Request) (e error)
ScalarError(w http.ResponseWriter, r *http.Request) (e error)
CustomError(w http.ResponseWriter, r *http.Request) (e error)