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
// empty structs.
var mimeInlineBrowserWhitelist = map[string]struct{}{
"text/plain": struct{}{},
"text/plain": {},
"image/png": struct{}{},
"image/jpeg": struct{}{},
"image/gif": struct{}{},
"image/bmp": struct{}{},
"image/webp": struct{}{},
"image/png": {},
"image/jpeg": {},
"image/gif": {},
"image/bmp": {},
"image/webp": {},
"audio/wave": struct{}{},
"audio/wav": struct{}{},
"audio/x-wav": struct{}{},
"audio/x-pn-wav": struct{}{},
"audio/webm": struct{}{},
"video/webm": struct{}{},
"audio/ogg": struct{}{},
"video/ogg": struct{}{},
"application/ogg": struct{}{},
"audio/wave": {},
"audio/wav": {},
"audio/x-wav": {},
"audio/x-pn-wav": {},
"audio/webm": {},
"video/webm": {},
"audio/ogg": {},
"video/ogg": {},
"application/ogg": {},
}
// filterContentType returns the values for the Content-Type and

View File

@ -4,7 +4,7 @@ import (
"context"
"errors"
"fmt"
"os"
"io"
"github.com/aws/aws-sdk-go/aws/request"
"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 {
objectSize = *input.ContentLength
} else {
size, err := input.Body.Seek(0, os.SEEK_END)
size, err := input.Body.Seek(0, io.SeekEnd)
if err != nil {
return nil, err
}
_, err = input.Body.Seek(0, os.SEEK_SET)
_, err = input.Body.Seek(0, io.SeekStart)
if err != nil {
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) {
elapsed := time.Now().Sub(start)
elapsed := time.Since(start)
ms := float64(elapsed.Nanoseconds() / int64(time.Millisecond))
store.requestDurationMetric.WithLabelValues(label).Observe(ms)
@ -847,7 +847,7 @@ func (upload s3Upload) FinishUpload(ctx context.Context) error {
}
parts = []*s3Part{
&s3Part{
{
etag: *res.ETag,
number: 1,
size: 0,

View File

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