mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
fix: lint errors
This commit is contained in:
parent
609c0067a7
commit
c19ce8f1d0
@ -21,8 +21,8 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ScalarErrorOne ScalarError = "scalar error one"
|
ScalarErrorOne ScalarError = "scalar error one" //nolint:errname
|
||||||
ScalarErrorTwo ScalarError = "scalar error two"
|
ScalarErrorTwo ScalarError = "scalar error two" //nolint:errname
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewScalarError(e ScalarError) *ScalarError {
|
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")
|
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
|
s := backend.ScalarOne
|
||||||
return &s
|
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) {
|
func (h *Handler) Struct(w http.ResponseWriter, r *http.Request) (e *backend.StructError) {
|
||||||
return &backend.Struct{
|
return &backend.StructError{
|
||||||
Message: "my custom scalar",
|
Message: "my custom scalar",
|
||||||
Data: "hello world",
|
Data: "hello world",
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,9 +14,9 @@ type ServiceGoTSRPCClient interface {
|
|||||||
CustomError(ctx go_context.Context) (e error, clientErr error)
|
CustomError(ctx go_context.Context) (e error, clientErr error)
|
||||||
Error(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)
|
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)
|
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)
|
TypedCustomError(ctx go_context.Context) (e error, clientErr error)
|
||||||
TypedError(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)
|
TypedScalarError(ctx go_context.Context) (e error, clientErr error)
|
||||||
@ -75,7 +75,7 @@ func (tsc *HTTPServiceGoTSRPCClient) MultiScalar(ctx go_context.Context) (e *Mul
|
|||||||
return
|
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{}{}
|
args := []interface{}{}
|
||||||
reply := []interface{}{&e}
|
reply := []interface{}{&e}
|
||||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Scalar", args, reply)
|
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
|
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{}{}
|
args := []interface{}{}
|
||||||
reply := []interface{}{&e}
|
reply := []interface{}{&e}
|
||||||
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Struct", args, reply)
|
clientErr = tsc.Client.Call(ctx, tsc.URL, tsc.EndPoint, "Struct", args, reply)
|
||||||
|
|||||||
@ -10,22 +10,22 @@ const (
|
|||||||
ErrUnauthorized ErrService = "unauthorized"
|
ErrUnauthorized ErrService = "unauthorized"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Scalar string
|
type ScalarError string
|
||||||
|
|
||||||
func (s Scalar) String() string {
|
func (s *ScalarError) String() string {
|
||||||
return string(s)
|
return string(*s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Scalar) Error() string {
|
func (s *ScalarError) Error() string {
|
||||||
return s.String()
|
return s.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Struct struct {
|
type StructError struct {
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Struct) Error() string {
|
func (s *StructError) Error() string {
|
||||||
return s.Message
|
return s.Message
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,8 +39,8 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ScalarOne Scalar = "one"
|
ScalarOne ScalarError = "one" //nolint:errname
|
||||||
ScalarTwo Scalar = "two"
|
ScalarTwo ScalarError = "two" //nolint:errname
|
||||||
|
|
||||||
ScalarAOne ScalarA = "one"
|
ScalarAOne ScalarA = "one"
|
||||||
ScalarATwo ScalarA = "two"
|
ScalarATwo ScalarA = "two"
|
||||||
@ -51,9 +51,9 @@ const (
|
|||||||
|
|
||||||
type Service interface {
|
type Service interface {
|
||||||
Error(w http.ResponseWriter, r *http.Request) (e error)
|
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)
|
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)
|
TypedError(w http.ResponseWriter, r *http.Request) (e error)
|
||||||
ScalarError(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)
|
CustomError(w http.ResponseWriter, r *http.Request) (e error)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user