diff --git a/pkg/handler/unrouted_handler.go b/pkg/handler/unrouted_handler.go index 72fb06d..0397bd3 100644 --- a/pkg/handler/unrouted_handler.go +++ b/pkg/handler/unrouted_handler.go @@ -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 diff --git a/pkg/s3store/minio_s3_api.go b/pkg/s3store/minio_s3_api.go index 199350a..028b8c0 100644 --- a/pkg/s3store/minio_s3_api.go +++ b/pkg/s3store/minio_s3_api.go @@ -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 } diff --git a/pkg/s3store/s3store.go b/pkg/s3store/s3store.go index 748b778..0016d14 100644 --- a/pkg/s3store/s3store.go +++ b/pkg/s3store/s3store.go @@ -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, diff --git a/pkg/s3store/s3store_part_producer.go b/pkg/s3store/s3store_part_producer.go index 07a80bd..802c834 100644 --- a/pkg/s3store/s3store_part_producer.go +++ b/pkg/s3store/s3store_part_producer.go @@ -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)