From bd23c64a1283835f5991444bb47ec3da1895ff42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 1 Jul 2024 13:05:01 +0200 Subject: Fix gophercloud lint complains --- object_iterator.go | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'object_iterator.go') diff --git a/object_iterator.go b/object_iterator.go index 64b5551..c6efa78 100644 --- a/object_iterator.go +++ b/object_iterator.go @@ -34,12 +34,12 @@ type ObjectInfo struct { ContentType string Etag string LastModified time.Time - //SymlinkTarget is only set for symlinks. + // SymlinkTarget is only set for symlinks. SymlinkTarget *Object - //If the ObjectInfo refers to an actual object, then SubDirectory is empty. - //If the ObjectInfo refers to a pseudo-directory, then SubDirectory contains - //the path of the pseudo-directory and all other fields are nil/zero/empty. - //Pseudo-directories will only be reported for ObjectIterator.Delimiter != "". + // If the ObjectInfo refers to an actual object, then SubDirectory is empty. + // If the ObjectInfo refers to a pseudo-directory, then SubDirectory contains + // the path of the pseudo-directory and all other fields are nil/zero/empty. + // Pseudo-directories will only be reported for ObjectIterator.Delimiter != "". SubDirectory string } @@ -74,14 +74,14 @@ type ObjectInfo struct { // which case Exists() will return false. type ObjectIterator struct { Container *Container - //When Prefix is set, only objects whose name starts with this string are - //returned. + // When Prefix is set, only objects whose name starts with this string are + // returned. Prefix string - //When Delimiter is set, objects whose name contains this string (after the - //prefix, if any) will be condensed into pseudo-directories in the result. - //See documentation for Swift for details. + // When Delimiter is set, objects whose name contains this string (after the + // prefix, if any) will be condensed into pseudo-directories in the result. + // See documentation for Swift for details. Delimiter string - //Options may contain additional headers and query parameters for the GET request. + // Options may contain additional headers and query parameters for the GET request. Options *RequestOptions base *iteratorBase @@ -124,14 +124,14 @@ func (i *ObjectIterator) NextPageDetailed(limit int) ([]ObjectInfo, error) { b := i.getBase() var document []struct { - //either all of this: + // either all of this: SizeBytes uint64 `json:"bytes"` ContentType string `json:"content_type"` Etag string `json:"hash"` LastModifiedStr string `json:"last_modified"` Name string `json:"name"` SymlinkPath string `json:"symlink_path"` - //or just this: + // or just this: Subdir string `json:"subdir"` } err := b.nextPageDetailed(limit, &document) @@ -139,7 +139,7 @@ func (i *ObjectIterator) NextPageDetailed(limit int) ([]ObjectInfo, error) { return nil, err } if len(document) == 0 { - b.setMarker("") //indicate EOF to iteratorBase + b.setMarker("") // indicate EOF to iteratorBase return nil, nil } @@ -154,13 +154,13 @@ func (i *ObjectIterator) NextPageDetailed(limit int) ([]ObjectInfo, error) { result[idx].SizeBytes = data.SizeBytes result[idx].LastModified, err = time.Parse(time.RFC3339Nano, data.LastModifiedStr+"Z") if err != nil { - //this error is sufficiently obscure that we don't need to expose a type for it + // this error is sufficiently obscure that we don't need to expose a type for it return nil, fmt.Errorf("bad field objects[%d].last_modified: %s", idx, err.Error()) } if data.SymlinkPath != "" { match := symlinkPathRx.FindStringSubmatch(data.SymlinkPath) if match == nil { - //like above + // like above return nil, fmt.Errorf("bad field objects[%d].symlink_path: %q", idx, data.SymlinkPath) } a := i.Container.a @@ -189,7 +189,7 @@ func (i *ObjectIterator) Foreach(callback func(*Object) error) error { return err } if len(objects) == 0 { - return nil //EOF + return nil // EOF } for _, o := range objects { err := callback(o) @@ -208,7 +208,7 @@ func (i *ObjectIterator) ForeachDetailed(callback func(ObjectInfo) error) error return err } if len(infos) == 0 { - return nil //EOF + return nil // EOF } for _, ci := range infos { err := callback(ci) @@ -230,7 +230,7 @@ func (i *ObjectIterator) Collect() ([]*Object, error) { return nil, err } if len(objects) == 0 { - return result, nil //EOF + return result, nil // EOF } result = append(result, objects...) } @@ -245,7 +245,7 @@ func (i *ObjectIterator) CollectDetailed() ([]ObjectInfo, error) { return nil, err } if len(infos) == 0 { - return result, nil //EOF + return result, nil // EOF } result = append(result, infos...) } -- cgit v1.2.3