fix: lint issues

This commit is contained in:
Kevin Franklin Kim 2025-06-03 16:49:35 +02:00
parent 3b76712d0b
commit 8b207d632b
No known key found for this signature in database
5 changed files with 13 additions and 12 deletions

View File

@ -31,7 +31,7 @@ func NewClient() Client {
return &bufferedClient{client: defaultHttpFactory(), handle: getHandleForEncoding(EncodingMsgpack), headers: nil} 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 { if client != nil {
return &bufferedClient{client: client, handle: getHandleForEncoding(EncodingMsgpack), headers: nil} return &bufferedClient{client: client, handle: getHandleForEncoding(EncodingMsgpack), headers: nil}
} else { } else {
@ -71,7 +71,7 @@ func (c *bufferedClient) SetClientEncoding(encoding ClientEncoding) {
c.handle = getHandleForEncoding(encoding) 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 c.client = client
} }

View File

@ -9,7 +9,7 @@ import (
// Default Client Factory // Default Client Factory
// https://medium.com/@nate510/don-t-use-go-s-default-http-client-4804cb19f779 // 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{ transport := &http.Transport{
Proxy: http.ProxyFromEnvironment, Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{ 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 defaultHttpFactory = factory
} }

View File

@ -13,7 +13,7 @@ type ClientEncoding int
const ( const (
EncodingMsgpack = ClientEncoding(0) EncodingMsgpack = ClientEncoding(0)
EncodingJson = ClientEncoding(1) //nolint:stylecheck EncodingJson = ClientEncoding(1) //nolint:staticcheck
) )
var errorType = reflect.TypeOf((*error)(nil)).Elem() var errorType = reflect.TypeOf((*error)(nil)).Elem()

View File

@ -91,10 +91,10 @@ func extractJSONInfo(tag string) *JSONInfo {
} }
if len(jsonTags) > 1 { if len(jsonTags) > 1 {
for _, value := range jsonTags[1:] { for _, value := range jsonTags[1:] {
switch { switch value {
case value == "inline": case "inline":
inline = true inline = true
case value == "omitempty": case "omitempty":
omit = true omit = true
} }
} }

View File

@ -116,11 +116,12 @@ func renderTypescriptClient(service *Service, mappings config.TypeScriptMappings
} }
call := "this.transport<" + innerCallTypeString + ">(\"" + method.Name + "\", [" + strings.Join(callArgs, ", ") + "])" call := "this.transport<" + innerCallTypeString + ">(\"" + method.Name + "\", [" + strings.Join(callArgs, ", ") + "])"
if countReturns == 0 { switch countReturns {
case 0:
ts.l("await " + call) ts.l("await " + call)
} else if countReturns == 1 { case 1:
ts.l("return (await " + call + ")[0]") ts.l("return (await " + call + ")[0]")
} else { default:
ts.l("const response = await " + call) ts.l("const response = await " + call)
ts.l(responseObject) ts.l(responseObject)
} }