Skip to content

Commit e63bf4b

Browse files
committed
fix linter errors
Signed-off-by: Tom Plowman <[email protected]>
1 parent fe792ef commit e63bf4b

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
1313
- [#38](https://github.com/thanos-io/objstore/pull/38) GCS: Upgrade cloud.google.com/go/storage version to `v1.43.0`.
1414
- [#145](https://github.com/thanos-io/objstore/pull/145) Include content length in the response of Get and GetRange.
1515
- [#157](https://github.com/thanos-io/objstore/pull/157) Azure: Add `az_tenant_id`, `client_id` and `client_secret` configs.
16-
- [#174](https://github.com/thanos-io/objstore/pull/174) Feature: conditional object upload API
16+
- [#175](https://github.com/thanos-io/objstore/pull/174) Feature: conditional object upload API
1717

1818
### Fixed
1919
- [#153](https://github.com/thanos-io/objstore/pull/153) Metrics: Fix `objstore_bucket_operation_duration_seconds_*` for `get` and `get_range` operations.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ require (
1919
github.com/opentracing/opentracing-go v1.2.0
2020
github.com/oracle/oci-go-sdk/v65 v65.41.1
2121
github.com/pkg/errors v0.9.1
22+
github.com/pkg/xattr v0.4.10
2223
github.com/prometheus/client_golang v1.17.0
2324
github.com/prometheus/common v0.44.0
2425
github.com/tencentyun/cos-go-sdk-v5 v0.7.40
@@ -94,7 +95,6 @@ require (
9495
github.com/mozillazg/go-httpheader v0.2.1 // indirect
9596
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
9697
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
97-
github.com/pkg/xattr v0.4.10 // indirect
9898
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
9999
github.com/prometheus/client_model v0.6.1 // indirect
100100
github.com/prometheus/procfs v0.11.1 // indirect

objstore.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ type BucketReader interface {
122122
// IsAccessDeniedErr returns true if access to object is denied.
123123
IsAccessDeniedErr(err error) bool
124124

125-
// IsConditionNotMetErr returns true if an ObjectUploadOption condition parameter (IfNotExists, IfMatch, IfNotMatch) was not met
125+
// IsConditionNotMetErr returns true if an ObjectUploadOption condition parameter (IfNotExists, IfMatch, IfNotMatch) was not met.
126126
IsConditionNotMetErr(err error) bool
127127

128128
// Attributes returns information about the specified object.
@@ -263,7 +263,7 @@ func applyUploadOptions(options ...UploadOption) uploadParams {
263263
var ErrUploadOptionNotSupported = errors.New("upload option is not supported")
264264
var ErrUploadOptionInvalid = errors.New("upload option is invalid")
265265

266-
// ObjectUploadOptionType is used for type-safe option support checking of ObjectUpload options
266+
// ObjectUploadOptionType is used for type-safe option support checking of ObjectUpload options.
267267
type ObjectUploadOptionType int
268268

269269
const (
@@ -273,7 +273,7 @@ const (
273273
IfNotMatch
274274
)
275275

276-
// ObjectUploadOption configures UploadObjectParams
276+
// ObjectUploadOption configures UploadObjectParams.
277277
type ObjectUploadOption struct {
278278
Type ObjectUploadOptionType
279279
Apply func(params *UploadObjectParams)
@@ -288,7 +288,7 @@ type UploadObjectParams struct {
288288
Condition *ObjectVersion
289289
}
290290

291-
// WithContentType sets the content type of the object upload operation
291+
// WithContentType sets the content type of the object upload operation.
292292
func WithContentType(contentType string) ObjectUploadOption {
293293
return ObjectUploadOption{
294294
Type: ContentType,
@@ -332,7 +332,7 @@ func WithIfNotMatch(ver *ObjectVersion) ObjectUploadOption {
332332
}
333333
}
334334

335-
// ValidateUploadOptions ensures that only supported options are passed as options
335+
// ValidateUploadOptions ensures that only supported options are passed as options.
336336
func ValidateUploadOptions(supportedOptions []ObjectUploadOptionType, opts ...ObjectUploadOption) error {
337337
for _, opt := range opts {
338338
if !slices.Contains(supportedOptions, opt.Type) {
@@ -349,7 +349,7 @@ func ValidateUploadOptions(supportedOptions []ObjectUploadOptionType, opts ...Ob
349349
return nil
350350
}
351351

352-
// ApplyObjectUploadOptions creates UploadObjectParams from the options
352+
// ApplyObjectUploadOptions creates UploadObjectParams from the options.
353353
func ApplyObjectUploadOptions(opts ...ObjectUploadOption) UploadObjectParams {
354354
out := UploadObjectParams{}
355355
for _, opt := range opts {
@@ -369,20 +369,20 @@ type ObjectAttributes struct {
369369
Version *ObjectVersion `json:"version,omitempty"`
370370
}
371371

372-
// ObjectVersionType is used to specify the type of object version used by the underlying provider
372+
// ObjectVersionType is used to specify the type of object version used by the underlying provider.
373373
type ObjectVersionType int
374374

375375
const (
376-
// Generation the provider supports a monotonically increasing integer version
376+
// Generation the provider supports a monotonically increasing integer version.
377377
Generation ObjectVersionType = iota
378-
// ETag the provider supports a hash or checksum version
378+
// ETag the provider supports a hash or checksum version.
379379
ETag ObjectVersionType = iota
380380
)
381381

382382
type ObjectVersion struct {
383-
// Type is the type of object version supported by the provider
383+
// Type is the type of object version supported by the provider.
384384
Type ObjectVersionType
385-
// Value is a string representation of the version data from the provider
385+
// Value is a string representation of the version data from the provider.
386386
Value string
387387
}
388388

prefixed_bucket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (p *PrefixedBucket) IsAccessDeniedErr(err error) bool {
9898
return p.bkt.IsAccessDeniedErr(err)
9999
}
100100

101-
// IsConditionNotMetErr returns true if err meets is a condition not met error in the underlying provider
101+
// IsConditionNotMetErr returns true if err meets is a condition not met error in the underlying provider.
102102
func (p *PrefixedBucket) IsConditionNotMetErr(err error) bool { return p.bkt.IsConditionNotMetErr(err) }
103103

104104
// Attributes returns information about the specified object.

providers/azure/azure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func (b *Bucket) IsAccessDeniedErr(err error) bool {
307307
return bloberror.HasCode(err, bloberror.AuthorizationPermissionMismatch) || bloberror.HasCode(err, bloberror.InsufficientAccountPermissions)
308308
}
309309

310-
// IsConditionNotMetErr returns true if the error was a blob error nad the code is ConditionNotMet, or BlobAlreadyExists
310+
// IsConditionNotMetErr returns true if the error was a blob error nad the code is ConditionNotMet, or BlobAlreadyExists.
311311
func (b *Bucket) IsConditionNotMetErr(err error) bool {
312312
return errors.Is(err, errConditionInvalid) ||
313313
bloberror.HasCode(err, bloberror.BlobAlreadyExists) ||
@@ -387,7 +387,7 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader, uploadOpt
387387
if err := objstore.ValidateUploadOptions(b.SupportedObjectUploadOptions(), uploadOpts...); err != nil {
388388
return err
389389
}
390-
390+
391391
level.Debug(b.logger).Log("msg", "uploading blob", "blob", name)
392392
blobClient := b.containerClient.NewBlockBlobClient(name)
393393

providers/filesystem/filesystem.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ func (b *Bucket) checksum(name string) (string, error) {
372372
file := filepath.Join(b.rootDir, name)
373373
bytes, err := xattr.Get(file, xAttrKey)
374374
if err != nil {
375-
return "", err // Legacy filesystem buckets would just return empty string for the version (until objects updated)
375+
return "", err // Legacy filesystem buckets would just return empty string for the version (until objects updated).
376376
}
377377
return string(bytes), nil
378378
}
@@ -395,7 +395,7 @@ func (b *Bucket) checkConditions(name string, params objstore.UploadObjectParams
395395
return errConditionNotMet
396396
}
397397
}
398-
//... if the file doesn't exist, and it's an IfNotMatch, that's always fine
398+
//... if the file doesn't exist, and it's an IfNotMatch, that's always fine.
399399
return nil
400400
}
401401

@@ -456,7 +456,7 @@ func (b *Bucket) IsAccessDeniedErr(_ error) bool {
456456
return false
457457
}
458458

459-
// IsConditionNotMetErr returns true if the error is an internal condition not met error or a ErrExist filesystem error
459+
// IsConditionNotMetErr returns true if the error is an internal condition not met error or a ErrExist filesystem error.
460460
func (b *Bucket) IsConditionNotMetErr(err error) bool {
461461
return errors.Is(err, errConditionNotMet) || errors.Is(err, fs.ErrExist)
462462
}

providers/gcs/gcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func (b *Bucket) IsAccessDeniedErr(err error) bool {
399399
return false
400400
}
401401

402-
// IsConditionNotMetErr returns true if the response status code was Precondition Failed or Not Modified
402+
// IsConditionNotMetErr returns true if the response status code was Precondition Failed or Not Modified.
403403
func (b *Bucket) IsConditionNotMetErr(err error) bool {
404404
var gapiErr *googleapi.Error
405405
// See https://cloud.google.com/storage/docs/json_api/v1/status-codes

0 commit comments

Comments
 (0)