From 04ce17415f25dbf10eba954212c8428ae630df88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 26 Oct 2022 11:31:22 +0200 Subject: Format with go 1.19 --- request.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'request.go') diff --git a/request.go b/request.go index 266bee2..b789161 100644 --- a/request.go +++ b/request.go @@ -27,18 +27,17 @@ import ( "strings" ) -//RequestOptions is used to pass additional headers and values to a request. +// RequestOptions is used to pass additional headers and values to a request. // -//When preparing a RequestOptions instance with additional headers, the -//preferred way is to create an AccountHeaders, ContainerHeaders and -//ObjectHeaders instance and use the type-safe API on these types. Then use the -//ToOpts() method on that instance. For example: +// When preparing a RequestOptions instance with additional headers, the +// preferred way is to create an AccountHeaders, ContainerHeaders and +// ObjectHeaders instance and use the type-safe API on these types. Then use the +// ToOpts() method on that instance. For example: // // hdr := NewObjectHeaders() // hdr.ContentType().Set("image/png") // hdr.Metadata().Set("color", "blue") // opts := hdr.ToOpts() //type *schwift.RequestOptions -// type RequestOptions struct { Headers Headers Values url.Values @@ -65,7 +64,7 @@ func cloneRequestOptions(orig *RequestOptions, additional Headers) *RequestOptio return &result } -//Request contains the parameters that can be set in a request to the Swift API. +// Request contains the parameters that can be set in a request to the Swift API. type Request struct { Method string //"GET", "HEAD", "PUT", "POST" or "DELETE" ContainerName string //empty for requests on accounts @@ -80,7 +79,7 @@ type Request struct { DrainResponseBody bool } -//URL returns the full URL for this request. +// URL returns the full URL for this request. func (r Request) URL(backend Backend, values url.Values) (string, error) { uri, err := url.Parse(backend.EndpointURL()) if err != nil { @@ -107,7 +106,7 @@ func (r Request) URL(backend Backend, values url.Values) (string, error) { return uri.String(), nil } -//Do executes this request on the given Backend. +// Do executes this request on the given Backend. func (r Request) Do(backend Backend) (*http.Response, error) { //build URL var values url.Values -- cgit v1.2.3 From 8b38a040830109f19550e7329b82ec5caf76b321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 26 Oct 2022 15:23:04 +0200 Subject: Fix linting errors --- request.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'request.go') diff --git a/request.go b/request.go index b789161..2e78f00 100644 --- a/request.go +++ b/request.go @@ -21,7 +21,6 @@ package schwift import ( "context" "io" - "io/ioutil" "net/http" "net/url" "strings" @@ -169,7 +168,7 @@ func (r Request) Do(backend Backend) (*http.Response, error) { } func drainResponseBody(r *http.Response) error { - _, err := io.Copy(ioutil.Discard, r.Body) + _, err := io.Copy(io.Discard, r.Body) if err != nil { return err } @@ -177,7 +176,7 @@ func drainResponseBody(r *http.Response) error { } func collectResponseBody(r *http.Response) ([]byte, error) { - buf, err := ioutil.ReadAll(r.Body) + buf, err := io.ReadAll(r.Body) if err != nil { return nil, err } -- cgit v1.2.3