chore: Address misc linting warnings

This commit is contained in:
Marius Kleidl 2023-06-09 11:07:05 +02:00
parent b10c1876b1
commit 7b9030c33a
No known key found for this signature in database
GPG Key ID: 2F8AC5B12D755265
4 changed files with 22 additions and 22 deletions

View File

@ -761,23 +761,23 @@ func (handler *UnroutedHandler) GetFile(w http.ResponseWriter, r *http.Request)
// The values of this map does not convey any meaning and are therefore just // The values of this map does not convey any meaning and are therefore just
// empty structs. // empty structs.
var mimeInlineBrowserWhitelist = map[string]struct{}{ var mimeInlineBrowserWhitelist = map[string]struct{}{
"text/plain": struct{}{}, "text/plain": {},
"image/png": struct{}{}, "image/png": {},
"image/jpeg": struct{}{}, "image/jpeg": {},
"image/gif": struct{}{}, "image/gif": {},
"image/bmp": struct{}{}, "image/bmp": {},
"image/webp": struct{}{}, "image/webp": {},
"audio/wave": struct{}{}, "audio/wave": {},
"audio/wav": struct{}{}, "audio/wav": {},
"audio/x-wav": struct{}{}, "audio/x-wav": {},
"audio/x-pn-wav": struct{}{}, "audio/x-pn-wav": {},
"audio/webm": struct{}{}, "audio/webm": {},
"video/webm": struct{}{}, "video/webm": {},
"audio/ogg": struct{}{}, "audio/ogg": {},
"video/ogg": struct{}{}, "video/ogg": {},
"application/ogg": struct{}{}, "application/ogg": {},
} }
// filterContentType returns the values for the Content-Type and // filterContentType returns the values for the Content-Type and

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"os" "io"
"github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3"
@ -26,11 +26,11 @@ func (s MinioS3API) PutObjectWithContext(ctx context.Context, input *s3.PutObjec
if input.ContentLength != nil { if input.ContentLength != nil {
objectSize = *input.ContentLength objectSize = *input.ContentLength
} else { } else {
size, err := input.Body.Seek(0, os.SEEK_END) size, err := input.Body.Seek(0, io.SeekEnd)
if err != nil { if err != nil {
return nil, err return nil, err
} }
_, err = input.Body.Seek(0, os.SEEK_SET) _, err = input.Body.Seek(0, io.SeekStart)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -276,7 +276,7 @@ func (store S3Store) RegisterMetrics(registry prometheus.Registerer) {
} }
func (store S3Store) observeRequestDuration(start time.Time, label string) { func (store S3Store) observeRequestDuration(start time.Time, label string) {
elapsed := time.Now().Sub(start) elapsed := time.Since(start)
ms := float64(elapsed.Nanoseconds() / int64(time.Millisecond)) ms := float64(elapsed.Nanoseconds() / int64(time.Millisecond))
store.requestDurationMetric.WithLabelValues(label).Observe(ms) store.requestDurationMetric.WithLabelValues(label).Observe(ms)
@ -847,7 +847,7 @@ func (upload s3Upload) FinishUpload(ctx context.Context) error {
} }
parts = []*s3Part{ parts = []*s3Part{
&s3Part{ {
etag: *res.ETag, etag: *res.ETag,
number: 1, number: 1,
size: 0, size: 0,

View File

@ -107,7 +107,7 @@ func (spp *s3PartProducer) nextPart(size int64) (fileChunk, bool, error) {
return fileChunk{}, false, nil return fileChunk{}, false, nil
} }
elapsed := time.Now().Sub(start) elapsed := time.Since(start)
ms := float64(elapsed.Nanoseconds() / int64(time.Millisecond)) ms := float64(elapsed.Nanoseconds() / int64(time.Millisecond))
spp.diskWriteDurationMetric.Observe(ms) spp.diskWriteDurationMetric.Observe(ms)
@ -141,7 +141,7 @@ func (spp *s3PartProducer) nextPart(size int64) (fileChunk, bool, error) {
return fileChunk{}, false, nil return fileChunk{}, false, nil
} }
elapsed := time.Now().Sub(start) elapsed := time.Since(start)
ms := float64(elapsed.Nanoseconds() / int64(time.Millisecond)) ms := float64(elapsed.Nanoseconds() / int64(time.Millisecond))
spp.diskWriteDurationMetric.Observe(ms) spp.diskWriteDurationMetric.Observe(ms)