mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
fix: lint issues
This commit is contained in:
parent
3b76712d0b
commit
8b207d632b
@ -31,7 +31,7 @@ func NewClient() Client {
|
||||
return &bufferedClient{client: defaultHttpFactory(), handle: getHandleForEncoding(EncodingMsgpack), headers: nil}
|
||||
}
|
||||
|
||||
func NewClientWithHttpClient(client *http.Client) Client { //nolint:stylecheck
|
||||
func NewClientWithHttpClient(client *http.Client) Client { //nolint:staticcheck
|
||||
if client != nil {
|
||||
return &bufferedClient{client: client, handle: getHandleForEncoding(EncodingMsgpack), headers: nil}
|
||||
} else {
|
||||
@ -71,7 +71,7 @@ func (c *bufferedClient) SetClientEncoding(encoding ClientEncoding) {
|
||||
c.handle = getHandleForEncoding(encoding)
|
||||
}
|
||||
|
||||
func (c *bufferedClient) SetTransportHttpClient(client *http.Client) { //nolint:stylecheck
|
||||
func (c *bufferedClient) SetTransportHttpClient(client *http.Client) { //nolint:staticcheck
|
||||
c.client = client
|
||||
}
|
||||
|
||||
|
||||
6
http.go
6
http.go
@ -9,7 +9,7 @@ import (
|
||||
// Default Client Factory
|
||||
// https://medium.com/@nate510/don-t-use-go-s-default-http-client-4804cb19f779
|
||||
|
||||
var defaultHttpFactory HttpClientFactory = func() *http.Client { //nolint:stylecheck
|
||||
var defaultHttpFactory HttpClientFactory = func() *http.Client { //nolint:staticcheck
|
||||
transport := &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: (&net.Dialer{
|
||||
@ -28,8 +28,8 @@ var defaultHttpFactory HttpClientFactory = func() *http.Client { //nolint:stylec
|
||||
}
|
||||
}
|
||||
|
||||
type HttpClientFactory func() *http.Client //nolint:stylecheck
|
||||
type HttpClientFactory func() *http.Client //nolint:staticcheck
|
||||
|
||||
func SetDefaultHttpClientFactory(factory HttpClientFactory) { //nolint:stylecheck
|
||||
func SetDefaultHttpClientFactory(factory HttpClientFactory) { //nolint:staticcheck
|
||||
defaultHttpFactory = factory
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ type ClientEncoding int
|
||||
|
||||
const (
|
||||
EncodingMsgpack = ClientEncoding(0)
|
||||
EncodingJson = ClientEncoding(1) //nolint:stylecheck
|
||||
EncodingJson = ClientEncoding(1) //nolint:staticcheck
|
||||
)
|
||||
|
||||
var errorType = reflect.TypeOf((*error)(nil)).Elem()
|
||||
|
||||
@ -91,10 +91,10 @@ func extractJSONInfo(tag string) *JSONInfo {
|
||||
}
|
||||
if len(jsonTags) > 1 {
|
||||
for _, value := range jsonTags[1:] {
|
||||
switch {
|
||||
case value == "inline":
|
||||
switch value {
|
||||
case "inline":
|
||||
inline = true
|
||||
case value == "omitempty":
|
||||
case "omitempty":
|
||||
omit = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,11 +116,12 @@ func renderTypescriptClient(service *Service, mappings config.TypeScriptMappings
|
||||
}
|
||||
|
||||
call := "this.transport<" + innerCallTypeString + ">(\"" + method.Name + "\", [" + strings.Join(callArgs, ", ") + "])"
|
||||
if countReturns == 0 {
|
||||
switch countReturns {
|
||||
case 0:
|
||||
ts.l("await " + call)
|
||||
} else if countReturns == 1 {
|
||||
case 1:
|
||||
ts.l("return (await " + call + ")[0]")
|
||||
} else {
|
||||
default:
|
||||
ts.l("const response = await " + call)
|
||||
ts.l(responseObject)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user