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 --- headers.go | 64 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 33 deletions(-) (limited to 'headers.go') diff --git a/headers.go b/headers.go index 47a2f73..ec953d2 100644 --- a/headers.go +++ b/headers.go @@ -23,55 +23,54 @@ import ( "net/textproto" ) -//Headers represents a set of request headers or response headers. +// Headers represents a set of request headers or response headers. // -//Users will typically use one of the subtypes (AccountHeaders, -//ContainerHeaders, ObjectHeaders) instead, which provide type-safe access to -//well-known headers. The http.Header-like interface on this type can be used -//read and write arbitary headers. For example, the following calls are -//equivalent: +// Users will typically use one of the subtypes (AccountHeaders, +// ContainerHeaders, ObjectHeaders) instead, which provide type-safe access to +// well-known headers. The http.Header-like interface on this type can be used +// read and write arbitary headers. For example, the following calls are +// equivalent: // // h := make(AccountHeaders) // h.Headers.Set("X-Account-Meta-Quota-Bytes", "1048576") // h.BytesUsedQuota().Set(1048576) -// type Headers map[string]string -//Clear sets the value for the specified header to the empty string. When the -//Headers instance is then sent to the server with Update(), the server will -//delete the value for that header; cf. Del(). +// Clear sets the value for the specified header to the empty string. When the +// Headers instance is then sent to the server with Update(), the server will +// delete the value for that header; cf. Del(). func (h Headers) Clear(key string) { h[textproto.CanonicalMIMEHeaderKey(key)] = "" } -//Del deletes a key from the Headers instance. When the Headers instance is -//then sent to the server with Update(), a key which has been deleted with -//Del() will remain unchanged on the server. +// Del deletes a key from the Headers instance. When the Headers instance is +// then sent to the server with Update(), a key which has been deleted with +// Del() will remain unchanged on the server. // -//For most writable attributes, a key which has been deleted with Del() will -//remain unchanged on the server. To remove the key on the server, use Clear() -//instead. +// For most writable attributes, a key which has been deleted with Del() will +// remain unchanged on the server. To remove the key on the server, use Clear() +// instead. // -//For object metadata (but not other object attributes), deleting a key will -//cause that key to be deleted on the server. Del() is identical to Clear() in -//this case. +// For object metadata (but not other object attributes), deleting a key will +// cause that key to be deleted on the server. Del() is identical to Clear() in +// this case. func (h Headers) Del(key string) { delete(h, textproto.CanonicalMIMEHeaderKey(key)) } -//Get returns the value for the specified header. +// Get returns the value for the specified header. func (h Headers) Get(key string) string { return h[textproto.CanonicalMIMEHeaderKey(key)] } -//Set sets a new value for the specified header. Any existing value will be -//overwritten. +// Set sets a new value for the specified header. Any existing value will be +// overwritten. func (h Headers) Set(key, value string) { h[textproto.CanonicalMIMEHeaderKey(key)] = value } -//ToHTTP converts this Headers instance into the equivalent http.Header -//instance. The return value is guaranteed to be non-nil. +// ToHTTP converts this Headers instance into the equivalent http.Header +// instance. The return value is guaranteed to be non-nil. func (h Headers) ToHTTP() http.Header { dest := make(http.Header, len(h)) for k, v := range h { @@ -80,14 +79,13 @@ func (h Headers) ToHTTP() http.Header { return dest } -//ToOpts wraps this Headers instance into a RequestOpts instance, so that it -//can be passed to Schwift's various request methods. +// ToOpts wraps this Headers instance into a RequestOpts instance, so that it +// can be passed to Schwift's various request methods. // // hdr := NewObjectHeaders() // hdr.ContentType().Set("image/png") // hdr.Metadata().Set("color", "blue") // obj.Upload(content, nil, hdr.ToOpts()) -// func (h Headers) ToOpts() *RequestOptions { return &RequestOptions{Headers: h} } @@ -105,20 +103,20 @@ func headersFromHTTP(src http.Header) Headers { //////////////////////////////////////////////////////////////////////////////// // specialized accessors on Headers subtypes that are not autogenerated -//IsDynamicLargeObject returns true if this set of headers belongs to a Dynamic -//Large Object (DLO). +// IsDynamicLargeObject returns true if this set of headers belongs to a Dynamic +// Large Object (DLO). func (h ObjectHeaders) IsDynamicLargeObject() bool { return h.Headers.Get("X-Object-Manifest") != "" } -//IsStaticLargeObject returns true if this set of headers belongs to a Static -//Large Object (SLO). +// IsStaticLargeObject returns true if this set of headers belongs to a Static +// Large Object (SLO). func (h ObjectHeaders) IsStaticLargeObject() bool { return h.Headers.Get("X-Static-Large-Object") == "True" } -//IsLargeObject returns true if this set of headers belongs to a large object -//(either an SLO or a DLO). +// IsLargeObject returns true if this set of headers belongs to a large object +// (either an SLO or a DLO). func (h ObjectHeaders) IsLargeObject() bool { return h.IsDynamicLargeObject() || h.IsStaticLargeObject() } -- cgit v1.2.3 From 72b8b1e9e393fa987f5ddfa205ace1ea01f2d592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 26 Oct 2022 13:47:07 +0200 Subject: Fix typos --- headers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'headers.go') diff --git a/headers.go b/headers.go index ec953d2..a4fda78 100644 --- a/headers.go +++ b/headers.go @@ -28,7 +28,7 @@ import ( // Users will typically use one of the subtypes (AccountHeaders, // ContainerHeaders, ObjectHeaders) instead, which provide type-safe access to // well-known headers. The http.Header-like interface on this type can be used -// read and write arbitary headers. For example, the following calls are +// read and write arbitrary headers. For example, the following calls are // equivalent: // // h := make(AccountHeaders) -- cgit v1.2.3