From eda34423d748d337a212c9cb73bf5ece4584f2c1 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 13 Apr 2022 12:00:11 -0700 Subject: [PATCH] update gofumpt -w - new changes --- cmd/admin-handlers-config-kv.go | 3 ++- cmd/auth-handler_test.go | 3 ++- cmd/bucket-handlers_test.go | 3 ++- cmd/bucket-lifecycle-handlers_test.go | 3 ++- cmd/bucket-policy-handlers_test.go | 6 ++++-- cmd/erasure-healing.go | 3 ++- cmd/erasure-sets.go | 3 ++- cmd/fs-v1.go | 6 ++++-- cmd/gateway-unsupported.go | 3 ++- cmd/gateway/azure/gateway-azure.go | 3 ++- cmd/gateway/gcs/gateway-gcs.go | 3 ++- cmd/gateway/hdfs/gateway-hdfs.go | 6 ++++-- cmd/gateway/s3/gateway-s3-sse.go | 3 ++- cmd/gateway/s3/gateway-s3.go | 3 ++- cmd/notification.go | 3 ++- cmd/object-handlers_test.go | 15 ++++++++++----- cmd/peer-rest-client.go | 3 ++- cmd/post-policy_test.go | 3 ++- cmd/utils.go | 3 ++- internal/config/notify/parse.go | 6 ++++-- internal/kernel/kernel_utsname_uint8.go | 2 +- 21 files changed, 57 insertions(+), 29 deletions(-) diff --git a/cmd/admin-handlers-config-kv.go b/cmd/admin-handlers-config-kv.go index 552d85ec8..f031e6afe 100644 --- a/cmd/admin-handlers-config-kv.go +++ b/cmd/admin-handlers-config-kv.go @@ -97,7 +97,8 @@ func (a adminAPIHandlers) DelConfigKVHandler(w http.ResponseWriter, r *http.Requ } func applyDynamic(ctx context.Context, objectAPI ObjectLayer, cfg config.Config, subSys string, - r *http.Request, w http.ResponseWriter) { + r *http.Request, w http.ResponseWriter, +) { // Apply dynamic values. if err := applyDynamicConfigForSubSys(GlobalContext, objectAPI, cfg, subSys); err != nil { writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL) diff --git a/cmd/auth-handler_test.go b/cmd/auth-handler_test.go index f048c957a..7b871f2c8 100644 --- a/cmd/auth-handler_test.go +++ b/cmd/auth-handler_test.go @@ -341,7 +341,8 @@ func mustNewSignedEmptyMD5Request(method string, urlStr string, contentLength in } func mustNewSignedBadMD5Request(method string, urlStr string, contentLength int64, - body io.ReadSeeker, t *testing.T) *http.Request { + body io.ReadSeeker, t *testing.T, +) *http.Request { req := mustNewRequest(method, urlStr, contentLength, body, t) req.Header.Set("Content-Md5", "YWFhYWFhYWFhYWFhYWFhCg==") cred := globalActiveCred diff --git a/cmd/bucket-handlers_test.go b/cmd/bucket-handlers_test.go index 2103896f1..ff2fb56e3 100644 --- a/cmd/bucket-handlers_test.go +++ b/cmd/bucket-handlers_test.go @@ -36,7 +36,8 @@ func TestRemoveBucketHandler(t *testing.T) { } func testRemoveBucketHandler(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { _, err := obj.PutObject(GlobalContext, bucketName, "test-object", mustGetPutObjReader(t, bytes.NewReader([]byte{}), int64(0), "", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"), ObjectOptions{}) // if object upload fails stop the test. if err != nil { diff --git a/cmd/bucket-lifecycle-handlers_test.go b/cmd/bucket-lifecycle-handlers_test.go index 1ecc5f532..b0a1cc497 100644 --- a/cmd/bucket-lifecycle-handlers_test.go +++ b/cmd/bucket-lifecycle-handlers_test.go @@ -34,7 +34,8 @@ func TestBucketLifecycleWrongCredentials(t *testing.T) { // Test for authentication func testBucketLifecycleHandlersWrongCredentials(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { // test cases with sample input and expected output. testCases := []struct { method string diff --git a/cmd/bucket-policy-handlers_test.go b/cmd/bucket-policy-handlers_test.go index b9ef9408e..c69762d96 100644 --- a/cmd/bucket-policy-handlers_test.go +++ b/cmd/bucket-policy-handlers_test.go @@ -113,7 +113,8 @@ func TestCreateBucket(t *testing.T) { // testCreateBucket - Test for calling Create Bucket and ensure we get one and only one success. func testCreateBucket(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { bucketName1 := fmt.Sprintf("%s-1", bucketName) const n = 100 @@ -378,7 +379,8 @@ func TestGetBucketPolicyHandler(t *testing.T) { // testGetBucketPolicyHandler - Test for end point which fetches the access policy json of the given bucket. func testGetBucketPolicyHandler(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { // template for constructing HTTP request body for PUT bucket policy. bucketPolicyTemplate := `{"Version":"2012-10-17","Statement":[{"Action":["s3:GetBucketLocation","s3:ListBucket"],"Effect":"Allow","Principal":{"AWS":["*"]},"Resource":["arn:aws:s3:::%s"]},{"Action":["s3:GetObject"],"Effect":"Allow","Principal":{"AWS":["*"]},"Resource":["arn:aws:s3:::%s/this*"]}]}` diff --git a/cmd/erasure-healing.go b/cmd/erasure-healing.go index 9b7f58a24..fe4921dcf 100644 --- a/cmd/erasure-healing.go +++ b/cmd/erasure-healing.go @@ -60,7 +60,8 @@ func (fi FileInfo) DataShardFixed() bool { // also heals the missing entries for bucket metadata files // `policy.json, notification.xml, listeners.json`. func (er erasureObjects) HealBucket(ctx context.Context, bucket string, opts madmin.HealOpts) ( - result madmin.HealResultItem, err error) { + result madmin.HealResultItem, err error, +) { if !opts.DryRun { defer NSUpdated(bucket, slashSeparator) } diff --git a/cmd/erasure-sets.go b/cmd/erasure-sets.go index 9566c1b76..e926268ba 100644 --- a/cmd/erasure-sets.go +++ b/cmd/erasure-sets.go @@ -1099,7 +1099,8 @@ func (s *erasureSets) NewMultipartUpload(ctx context.Context, bucket, object str // Copies a part of an object from source hashedSet to destination hashedSet. func (s *erasureSets) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, uploadID string, partID int, - startOffset int64, length int64, srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (partInfo PartInfo, err error) { + startOffset int64, length int64, srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions, +) (partInfo PartInfo, err error) { destSet := s.getHashedSet(destObject) auditObjectErasureSet(ctx, destObject, destSet) return destSet.PutObjectPart(ctx, destBucket, destObject, uploadID, partID, NewPutObjReader(srcInfo.Reader), dstOpts) diff --git a/cmd/fs-v1.go b/cmd/fs-v1.go index d0b350439..1f0d22314 100644 --- a/cmd/fs-v1.go +++ b/cmd/fs-v1.go @@ -1362,13 +1362,15 @@ func (fs *FSObjects) HealFormat(ctx context.Context, dryRun bool) (madmin.HealRe // HealObject - no-op for fs. Valid only for Erasure. func (fs *FSObjects) HealObject(ctx context.Context, bucket, object, versionID string, opts madmin.HealOpts) ( - res madmin.HealResultItem, err error) { + res madmin.HealResultItem, err error, +) { return res, NotImplemented{} } // HealBucket - no-op for fs, Valid only for Erasure. func (fs *FSObjects) HealBucket(ctx context.Context, bucket string, opts madmin.HealOpts) (madmin.HealResultItem, - error) { + error, +) { return madmin.HealResultItem{}, NotImplemented{} } diff --git a/cmd/gateway-unsupported.go b/cmd/gateway-unsupported.go index 4f1c149db..6367bbea5 100644 --- a/cmd/gateway-unsupported.go +++ b/cmd/gateway-unsupported.go @@ -211,7 +211,8 @@ func (a GatewayUnsupported) HealObjects(ctx context.Context, bucket, prefix stri // CopyObject copies a blob from source container to destination container. func (a GatewayUnsupported) CopyObject(ctx context.Context, srcBucket string, srcObject string, destBucket string, destObject string, - srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (objInfo ObjectInfo, err error) { + srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions, +) (objInfo ObjectInfo, err error) { return objInfo, NotImplemented{} } diff --git a/cmd/gateway/azure/gateway-azure.go b/cmd/gateway/azure/gateway-azure.go index 5d3f25884..2c45165b1 100644 --- a/cmd/gateway/azure/gateway-azure.go +++ b/cmd/gateway/azure/gateway-azure.go @@ -1072,7 +1072,8 @@ func (a *azureObjects) NewMultipartUpload(ctx context.Context, bucket, object st } func (a *azureObjects) CopyObjectPart(ctx context.Context, srcBucket, srcObject, dstBucket, dstObject string, uploadID string, partID int, - startOffset int64, length int64, srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions) (info minio.PartInfo, err error) { + startOffset int64, length int64, srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions, +) (info minio.PartInfo, err error) { return a.PutObjectPart(ctx, dstBucket, dstObject, uploadID, partID, srcInfo.PutObjReader, dstOpts) } diff --git a/cmd/gateway/gcs/gateway-gcs.go b/cmd/gateway/gcs/gateway-gcs.go index 30a42afc1..9d2b3e3cc 100644 --- a/cmd/gateway/gcs/gateway-gcs.go +++ b/cmd/gateway/gcs/gateway-gcs.go @@ -929,7 +929,8 @@ func (l *gcsGateway) PutObject(ctx context.Context, bucket string, key string, r // CopyObject - Copies a blob from source container to destination container. func (l *gcsGateway) CopyObject(ctx context.Context, srcBucket string, srcObject string, destBucket string, destObject string, - srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions) (minio.ObjectInfo, error) { + srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions, +) (minio.ObjectInfo, error) { if srcOpts.CheckPrecondFn != nil && srcOpts.CheckPrecondFn(srcInfo) { return minio.ObjectInfo{}, minio.PreConditionFailed{} } diff --git a/cmd/gateway/hdfs/gateway-hdfs.go b/cmd/gateway/hdfs/gateway-hdfs.go index 7fd1e44be..1abe3b92a 100644 --- a/cmd/gateway/hdfs/gateway-hdfs.go +++ b/cmd/gateway/hdfs/gateway-hdfs.go @@ -536,7 +536,8 @@ func (n *hdfsObjects) deleteObject(basePath, deletePath string) error { // ListObjectsV2 lists all blobs in HDFS bucket filtered by prefix func (n *hdfsObjects) ListObjectsV2(ctx context.Context, bucket, prefix, continuationToken, delimiter string, maxKeys int, - fetchOwner bool, startAfter string) (loi minio.ListObjectsV2Info, err error) { + fetchOwner bool, startAfter string, +) (loi minio.ListObjectsV2Info, err error) { // fetchOwner is not supported and unused. marker := continuationToken if marker == "" { @@ -793,7 +794,8 @@ func (n *hdfsObjects) ListObjectParts(ctx context.Context, bucket, object, uploa } func (n *hdfsObjects) CopyObjectPart(ctx context.Context, srcBucket, srcObject, dstBucket, dstObject, uploadID string, partID int, - startOffset int64, length int64, srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions) (minio.PartInfo, error) { + startOffset int64, length int64, srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions, +) (minio.PartInfo, error) { return n.PutObjectPart(ctx, dstBucket, dstObject, uploadID, partID, srcInfo.PutObjReader, dstOpts) } diff --git a/cmd/gateway/s3/gateway-s3-sse.go b/cmd/gateway/s3/gateway-s3-sse.go index 7596636c0..2b4dcba04 100644 --- a/cmd/gateway/s3/gateway-s3-sse.go +++ b/cmd/gateway/s3/gateway-s3-sse.go @@ -549,7 +549,8 @@ func (l *s3EncObjects) PutObjectPart(ctx context.Context, bucket string, object // CopyObjectPart creates a part in a multipart upload by copying // existing object or a part of it. func (l *s3EncObjects) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject, uploadID string, - partID int, startOffset, length int64, srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions) (p minio.PartInfo, err error) { + partID int, startOffset, length int64, srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions, +) (p minio.PartInfo, err error) { return l.PutObjectPart(ctx, destBucket, destObject, uploadID, partID, srcInfo.PutObjReader, dstOpts) } diff --git a/cmd/gateway/s3/gateway-s3.go b/cmd/gateway/s3/gateway-s3.go index 8ea0d0b0b..7951b0be1 100644 --- a/cmd/gateway/s3/gateway-s3.go +++ b/cmd/gateway/s3/gateway-s3.go @@ -640,7 +640,8 @@ func (l *s3Objects) PutObjectPart(ctx context.Context, bucket string, object str // CopyObjectPart creates a part in a multipart upload by copying // existing object or a part of it. func (l *s3Objects) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject, uploadID string, - partID int, startOffset, length int64, srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions) (p minio.PartInfo, err error) { + partID int, startOffset, length int64, srcInfo minio.ObjectInfo, srcOpts, dstOpts minio.ObjectOptions, +) (p minio.PartInfo, err error) { if srcOpts.CheckPrecondFn != nil && srcOpts.CheckPrecondFn(srcInfo) { return minio.PartInfo{}, minio.PreConditionFailed{} } diff --git a/cmd/notification.go b/cmd/notification.go index b16fe527e..13a2e9618 100644 --- a/cmd/notification.go +++ b/cmd/notification.go @@ -1608,7 +1608,8 @@ func (sys *NotificationSys) Netperf(ctx context.Context, duration time.Duration) // Speedtest run GET/PUT tests at input concurrency for requested object size, // optionally you can extend the tests longer with time.Duration. func (sys *NotificationSys) Speedtest(ctx context.Context, size int, - concurrent int, duration time.Duration, storageClass string) []SpeedtestResult { + concurrent int, duration time.Duration, storageClass string, +) []SpeedtestResult { length := len(sys.allPeerClients) if length == 0 { // For single node erasure setup. diff --git a/cmd/object-handlers_test.go b/cmd/object-handlers_test.go index 44fbf2544..9384910de 100644 --- a/cmd/object-handlers_test.go +++ b/cmd/object-handlers_test.go @@ -62,7 +62,8 @@ func TestAPIHeadObjectHandler(t *testing.T) { } func testAPIHeadObjectHandler(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { objectName := "test-object" // set of byte data for PutObject. // object has to be created before running tests for HeadObject. @@ -2592,7 +2593,8 @@ func TestAPINewMultipartHandlerParallel(t *testing.T) { } func testAPINewMultipartHandlerParallel(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { // used for storing the uploadID's parsed on concurrent HTTP requests for NewMultipart upload on the same object. testUploads := struct { sync.Mutex @@ -3347,7 +3349,8 @@ func TestAPIPutObjectPartHandlerStreaming(t *testing.T) { } func testAPIPutObjectPartHandlerStreaming(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { testObject := "testobject" rec := httptest.NewRecorder() req, err := newTestSignedRequestV4(http.MethodPost, getNewMultipartURL("", bucketName, "testobject"), @@ -3748,7 +3751,8 @@ func TestAPIListObjectPartsHandlerPreSign(t *testing.T) { } func testAPIListObjectPartsHandlerPreSign(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { testObject := "testobject" rec := httptest.NewRecorder() req, err := newTestSignedRequestV4(http.MethodPost, getNewMultipartURL("", bucketName, testObject), @@ -3835,7 +3839,8 @@ func TestAPIListObjectPartsHandler(t *testing.T) { } func testAPIListObjectPartsHandler(obj ObjectLayer, instanceType, bucketName string, apiRouter http.Handler, - credentials auth.Credentials, t *testing.T) { + credentials auth.Credentials, t *testing.T, +) { testObject := "testobject" var opts ObjectOptions // PutObjectPart API HTTP Handler has to be tested in isolation, diff --git a/cmd/peer-rest-client.go b/cmd/peer-rest-client.go index a5592f7a6..89b395b9c 100644 --- a/cmd/peer-rest-client.go +++ b/cmd/peer-rest-client.go @@ -1039,7 +1039,8 @@ func (client *peerRESTClient) GetPeerMetrics(ctx context.Context) (<-chan Metric } func (client *peerRESTClient) Speedtest(ctx context.Context, size, - concurrent int, duration time.Duration, storageClass string) (SpeedtestResult, error) { + concurrent int, duration time.Duration, storageClass string, +) (SpeedtestResult, error) { values := make(url.Values) values.Set(peerRESTSize, strconv.Itoa(size)) values.Set(peerRESTConcurrent, strconv.Itoa(concurrent)) diff --git a/cmd/post-policy_test.go b/cmd/post-policy_test.go index f94f4e98d..3261118ff 100644 --- a/cmd/post-policy_test.go +++ b/cmd/post-policy_test.go @@ -581,7 +581,8 @@ func buildGenericPolicy(t time.Time, accessKey, region, bucketName, objectName s } func newPostRequestV4Generic(endPoint, bucketName, objectName string, objData []byte, accessKey, secretKey string, region string, - t time.Time, policy []byte, addFormData map[string]string, corruptedB64 bool, corruptedMultipart bool) (*http.Request, error) { + t time.Time, policy []byte, addFormData map[string]string, corruptedB64 bool, corruptedMultipart bool, +) (*http.Request, error) { // Get the user credential. credStr := getCredentialString(accessKey, region, t) diff --git a/cmd/utils.go b/cmd/utils.go index 4524963ce..8b6ea8123 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -699,7 +699,8 @@ func jsonLoad(r io.ReadSeeker, data interface{}) error { func jsonSave(f interface { io.WriteSeeker Truncate(int64) error -}, data interface{}) error { +}, data interface{}, +) error { b, err := json.Marshal(data) if err != nil { return err diff --git a/internal/config/notify/parse.go b/internal/config/notify/parse.go index b83b327a7..17c531fca 100644 --- a/internal/config/notify/parse.go +++ b/internal/config/notify/parse.go @@ -114,7 +114,8 @@ func RegisterNotificationTargets(ctx context.Context, cfg config.Config, transpo func fetchSubSysTargets(ctx context.Context, cfg config.Config, transport *http.Transport, test bool, returnOnTargetError bool, - subSys string, targetList *event.TargetList) (targetsOffline bool, err error) { + subSys string, targetList *event.TargetList, +) (targetsOffline bool, err error) { targetsOffline = false if err := checkValidNotificationKeysForSubSys(subSys, cfg[subSys]); err != nil { return targetsOffline, err @@ -1479,7 +1480,8 @@ var ( // GetNotifyWebhook - returns a map of registered notification 'webhook' targets func GetNotifyWebhook(webhookKVS map[string]config.KVS, transport *http.Transport) ( - map[string]target.WebhookArgs, error) { + map[string]target.WebhookArgs, error, +) { webhookTargets := make(map[string]target.WebhookArgs) for k, kv := range config.Merge(webhookKVS, target.EnvWebhookEnable, DefaultWebhookKVS) { enableEnv := target.EnvWebhookEnable diff --git a/internal/kernel/kernel_utsname_uint8.go b/internal/kernel/kernel_utsname_uint8.go index 49e5d672d..5b019d8da 100644 --- a/internal/kernel/kernel_utsname_uint8.go +++ b/internal/kernel/kernel_utsname_uint8.go @@ -15,7 +15,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -//go:build (linux && arm) || (linux && ppc64) || (linux && ppc64le) || (linux && s390x)|| (linux && riscv64) +//go:build (linux && arm) || (linux && ppc64) || (linux && ppc64le) || (linux && s390x) || (linux && riscv64) // +build linux,arm linux,ppc64 linux,ppc64le linux,s390x linux,riscv64 package kernel