diff options
author | Will Chandler <wchandler@gitlab.com> | 2022-09-30 21:40:24 +0300 |
---|---|---|
committer | Will Chandler <wchandler@gitlab.com> | 2022-09-30 23:09:00 +0300 |
commit | 76563783e6c7468a43397e0de5849ce7e534da78 (patch) | |
tree | 8c210a808b208af68f227ee8969f317c4be7f3fd /internal/gitlab/client/gitlabnet.go | |
parent | 4c15523cf680c107c5aa2b8268674cd0345a6b78 (diff) |
golangci-lint: Restore default revive lintswc/fix-revive-lints
With 7e87131ed (golangci-lint: Allow `testing.T` as first parameter,
2022-08-10) we set `context-as-argument` the sole argument to
`revive:rules`. This causes golangci-lint to disable all revive lints
that were previously enabled by default.
Re-enable the default revive lints by explicitly listing them in our
config. This triggers a large number of lint errors, resolve these as
well in this commit.
Diffstat (limited to 'internal/gitlab/client/gitlabnet.go')
-rw-r--r-- | internal/gitlab/client/gitlabnet.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/gitlab/client/gitlabnet.go b/internal/gitlab/client/gitlabnet.go index da4da1c93..61d72778d 100644 --- a/internal/gitlab/client/gitlabnet.go +++ b/internal/gitlab/client/gitlabnet.go @@ -24,10 +24,12 @@ const ( jwtIssuer = "gitlab-shell" ) +//nolint:revive // This is unintentionally missing documentation. type ErrorResponse struct { Message string `json:"message"` } +//nolint:revive // This is unintentionally missing documentation. type GitlabNetClient struct { httpClient *HTTPClient user string @@ -36,6 +38,7 @@ type GitlabNetClient struct { userAgent string } +//nolint:revive // This is unintentionally missing documentation. type APIError struct { Msg string } @@ -48,6 +51,7 @@ func (e *APIError) Error() string { return e.Msg } +//nolint:revive // This is unintentionally missing documentation. func NewGitlabNetClient( user, password, @@ -112,19 +116,22 @@ func parseError(resp *http.Response) error { if err := json.NewDecoder(resp.Body).Decode(parsedResponse); err != nil { return &APIError{fmt.Sprintf("Internal API error (%v)", resp.StatusCode)} - } else { - return &APIError{parsedResponse.Message} } + + return &APIError{parsedResponse.Message} } +//nolint:revive // This is unintentionally missing documentation. func (c *GitlabNetClient) Get(ctx context.Context, path string) (*http.Response, error) { return c.DoRequest(ctx, http.MethodGet, normalizePath(path), nil) } +//nolint:revive // This is unintentionally missing documentation. func (c *GitlabNetClient) Post(ctx context.Context, path string, data interface{}) (*http.Response, error) { return c.DoRequest(ctx, http.MethodPost, normalizePath(path), data) } +//nolint:revive // This is unintentionally missing documentation. func (c *GitlabNetClient) DoRequest(ctx context.Context, method, path string, data interface{}) (*http.Response, error) { request, err := newRequest(ctx, method, c.httpClient.Host, path, data) if err != nil { |