run gofumpt -extra on all source files (#4634)

This commit is contained in:
Harshavardhana
2023-07-17 13:10:20 -07:00
committed by GitHub
parent e8f049cbb1
commit 1fbd97aa04
32 changed files with 71 additions and 69 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ EXAMPLES:
}
// checkAliasSetSyntax - verifies input arguments to 'alias set'.
func checkAliasSetSyntax(ctx *cli.Context, accessKey string, secretKey string, deprecated bool) {
func checkAliasSetSyntax(ctx *cli.Context, accessKey, secretKey string, deprecated bool) {
args := ctx.Args()
argsNr := len(args)
+1 -1
View File
@@ -58,7 +58,7 @@ func (fs fsComplete) Predict(a complete.Args) []string {
return complete.PredictFiles("*").Predict(a)
}
func completeAdminConfigKeys(aliasPath string, keyPrefix string) (prediction []string) {
func completeAdminConfigKeys(aliasPath, keyPrefix string) (prediction []string) {
// Convert alias/bucket/incompl to alias/bucket/ to list its contents
parentDirPath := filepath.Dir(aliasPath) + "/"
clnt, err := newAdminClient(parentDirPath)
+2 -2
View File
@@ -925,7 +925,7 @@ func (f *fsClient) listInRoutine(contentCh chan<- *ClientContent) {
}
// List files recursively using non-recursive mode.
func (f *fsClient) listDirOpt(contentCh chan *ClientContent, isIncomplete bool, _ bool, dirOpt DirOpt) {
func (f *fsClient) listDirOpt(contentCh chan *ClientContent, isIncomplete, _ bool, dirOpt DirOpt) {
defer close(contentCh)
// Trim trailing / or \.
@@ -1191,7 +1191,7 @@ func (f *fsClient) GetObjectLegalHold(_ context.Context, _ string) (minio.LegalH
}
// GetAccess - get access policy permissions.
func (f *fsClient) GetAccess(_ context.Context) (access string, policyJSON string, err *probe.Error) {
func (f *fsClient) GetAccess(_ context.Context) (access, policyJSON string, err *probe.Error) {
// For windows this feature is not implemented.
if runtime.GOOS == "windows" {
return "", "", probe.NewError(APINotImplemented{API: "GetAccess", APIType: "filesystem"})
+5 -5
View File
@@ -336,7 +336,7 @@ func (c *S3Client) AddNotificationConfig(ctx context.Context, arn string, events
}
// RemoveNotificationConfig - Remove bucket notification
func (c *S3Client) RemoveNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error {
func (c *S3Client) RemoveNotificationConfig(ctx context.Context, arn, event, prefix, suffix string) *probe.Error {
bucket, _ := c.url2BucketAndObject()
// Remove all notification configs if arn is empty
if arn == "" {
@@ -1140,7 +1140,7 @@ func (c *S3Client) removeIncompleteObjects(ctx context.Context, bucket string, o
}
// AddUserAgent - add custom user agent.
func (c *S3Client) AddUserAgent(app string, version string) {
func (c *S3Client) AddUserAgent(app, version string) {
c.api.SetAppInfo(app, version)
}
@@ -1508,7 +1508,7 @@ func (c *S3Client) SetAccess(ctx context.Context, bucketPolicy string, isJSON bo
}
// listObjectWrapper - select ObjectList mode depending on arguments
func (c *S3Client) listObjectWrapper(ctx context.Context, bucket, object string, isRecursive bool, timeRef time.Time, withVersions, withDeleteMarkers bool, metadata bool, maxKeys int, zip bool) <-chan minio.ObjectInfo {
func (c *S3Client) listObjectWrapper(ctx context.Context, bucket, object string, isRecursive bool, timeRef time.Time, withVersions, withDeleteMarkers, metadata bool, maxKeys int, zip bool) <-chan minio.ObjectInfo {
if !timeRef.IsZero() || withVersions {
return c.listVersions(ctx, bucket, object, ListOptions{Recursive: isRecursive, TimeRef: timeRef, WithOlderVersions: withVersions, WithDeleteMarkers: withDeleteMarkers})
}
@@ -2150,7 +2150,7 @@ func (c *S3Client) bucketInfo2ClientContent(bucket minio.BucketInfo) *ClientCont
}
// Convert objectInfo to ClientContent
func (c *S3Client) prefixInfo2ClientContent(bucket string, prefix string) *ClientContent {
func (c *S3Client) prefixInfo2ClientContent(bucket, prefix string) *ClientContent {
// Join bucket and incoming object key.
if bucket == "" {
panic("should never happen, bucket cannot be empty")
@@ -2815,7 +2815,7 @@ func (c *S3Client) GetEncryption(ctx context.Context) (algorithm, keyID string,
}
// SetEncryption - Set encryption configuration on a bucket
func (c *S3Client) SetEncryption(ctx context.Context, encType string, kmsKeyID string) *probe.Error {
func (c *S3Client) SetEncryption(ctx context.Context, encType, kmsKeyID string) *probe.Error {
bucket, _ := c.url2BucketAndObject()
if bucket == "" {
return probe.NewError(BucketNameEmpty{})
+1 -1
View File
@@ -69,7 +69,7 @@ func getScheme(rawurl string) (scheme, path string) {
// Assuming s is of the form [s delimiter s].
// If so, return s, [delimiter]s or return s, s if cutdelimiter == true
// If no delimiter found return s, "".
func splitSpecial(s string, delimiter string, cutdelimiter bool) (string, string) {
func splitSpecial(s, delimiter string, cutdelimiter bool) (string, string) {
i := strings.Index(s, delimiter)
if i < 0 {
// if delimiter not found return as is.
+1 -1
View File
@@ -113,7 +113,7 @@ type Client interface {
GetObjectLockConfig(ctx context.Context) (status string, mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit, perr *probe.Error)
// Access policy operations.
GetAccess(ctx context.Context) (access string, policyJSON string, error *probe.Error)
GetAccess(ctx context.Context) (access, policyJSON string, error *probe.Error)
GetAccessRules(ctx context.Context) (policyRules map[string]string, error *probe.Error)
SetAccess(ctx context.Context, access string, isJSON bool) *probe.Error
+1 -1
View File
@@ -293,7 +293,7 @@ func getSourceStream(ctx context.Context, alias, urlStr string, opts getSourceOp
}
// putTargetRetention sets retention headers if any
func putTargetRetention(ctx context.Context, alias string, urlStr string, metadata map[string]string) *probe.Error {
func putTargetRetention(ctx context.Context, alias, urlStr string, metadata map[string]string) *probe.Error {
targetClnt, err := newClientFromAlias(alias, urlStr)
if err != nil {
return err.Trace(alias, urlStr)
+2 -2
View File
@@ -310,7 +310,7 @@ func expandAliasFromEnv(envURL string) (*aliasConfigV10, *probe.Error) {
}
// expandAlias expands aliased URL if any match is found, returns as is otherwise.
func expandAlias(aliasedURL string) (alias string, urlStr string, aliasCfg *aliasConfigV10, err *probe.Error) {
func expandAlias(aliasedURL string) (alias, urlStr string, aliasCfg *aliasConfigV10, err *probe.Error) {
// Extract alias from the URL.
alias, path := url2Alias(aliasedURL)
@@ -336,7 +336,7 @@ func expandAlias(aliasedURL string) (alias string, urlStr string, aliasCfg *alia
}
// mustExpandAlias expands aliased URL if any match is found, returns as is otherwise.
func mustExpandAlias(aliasedURL string) (alias string, urlStr string, aliasCfg *aliasConfigV10) {
func mustExpandAlias(aliasedURL string) (alias, urlStr string, aliasCfg *aliasConfigV10) {
alias, urlStr, aliasCfg, _ = expandAlias(aliasedURL)
return alias, urlStr, aliasCfg
}
+1 -1
View File
@@ -244,7 +244,7 @@ type ProgressReader interface {
}
// doCopy - Copy a single file from source to destination
func doCopy(ctx context.Context, cpURLs URLs, pg ProgressReader, encKeyDB map[string][]prefixSSEPair, isMvCmd bool, preserve, isZip bool) URLs {
func doCopy(ctx context.Context, cpURLs URLs, pg ProgressReader, encKeyDB map[string][]prefixSSEPair, isMvCmd, preserve, isZip bool) URLs {
if cpURLs.Error != nil {
cpURLs.Error = cpURLs.Error.Trace()
return cpURLs
+1 -1
View File
@@ -151,7 +151,7 @@ func checkCopySyntaxTypeA(ctx context.Context, srcURL, versionID string, keys ma
}
// checkCopySyntaxTypeB verifies if the source is a valid file and target is a valid folder.
func checkCopySyntaxTypeB(ctx context.Context, srcURL, versionID string, tgtURL string, keys map[string][]prefixSSEPair, isZip bool, timeRef time.Time) {
func checkCopySyntaxTypeB(ctx context.Context, srcURL, versionID, tgtURL string, keys map[string][]prefixSSEPair, isZip bool, timeRef time.Time) {
_, srcContent, err := url2Stat(ctx, srcURL, versionID, false, keys, timeRef, isZip)
fatalIf(err.Trace(srcURL), "Unable to stat source `"+srcURL+"`.")
+5 -5
View File
@@ -91,7 +91,7 @@ func guessCopyURLType(ctx context.Context, o prepareCopyURLsOpts) (copyURLsType,
// SINGLE SOURCE - Type A: copy(f, f) -> copy(f, f)
// prepareCopyURLsTypeA - prepares target and source clientURLs for copying.
func prepareCopyURLsTypeA(ctx context.Context, sourceURL, sourceVersion string, targetURL string, encKeyDB map[string][]prefixSSEPair, isZip bool) URLs {
func prepareCopyURLsTypeA(ctx context.Context, sourceURL, sourceVersion, targetURL string, encKeyDB map[string][]prefixSSEPair, isZip bool) URLs {
// Extract alias before fiddling with the clientURL.
sourceAlias, _, _ := mustExpandAlias(sourceURL)
// Find alias and expanded clientURL.
@@ -112,7 +112,7 @@ func prepareCopyURLsTypeA(ctx context.Context, sourceURL, sourceVersion string,
}
// prepareCopyContentTypeA - makes CopyURLs content for copying.
func makeCopyContentTypeA(sourceAlias string, sourceContent *ClientContent, targetAlias string, targetURL string) URLs {
func makeCopyContentTypeA(sourceAlias string, sourceContent *ClientContent, targetAlias, targetURL string) URLs {
targetContent := ClientContent{URL: *newClientURL(targetURL)}
return URLs{
SourceAlias: sourceAlias,
@@ -124,7 +124,7 @@ func makeCopyContentTypeA(sourceAlias string, sourceContent *ClientContent, targ
// SINGLE SOURCE - Type B: copy(f, d) -> copy(f, d/f) -> A
// prepareCopyURLsTypeB - prepares target and source clientURLs for copying.
func prepareCopyURLsTypeB(ctx context.Context, sourceURL, sourceVersion string, targetURL string, encKeyDB map[string][]prefixSSEPair, isZip bool) URLs {
func prepareCopyURLsTypeB(ctx context.Context, sourceURL, sourceVersion, targetURL string, encKeyDB map[string][]prefixSSEPair, isZip bool) URLs {
// Extract alias before fiddling with the clientURL.
sourceAlias, _, _ := mustExpandAlias(sourceURL)
// Find alias and expanded clientURL.
@@ -149,7 +149,7 @@ func prepareCopyURLsTypeB(ctx context.Context, sourceURL, sourceVersion string,
}
// makeCopyContentTypeB - CopyURLs content for copying.
func makeCopyContentTypeB(sourceAlias string, sourceContent *ClientContent, targetAlias string, targetURL string) URLs {
func makeCopyContentTypeB(sourceAlias string, sourceContent *ClientContent, targetAlias, targetURL string) URLs {
// All OK.. We can proceed. Type B: source is a file, target is a folder and exists.
targetURLParse := newClientURL(targetURL)
targetURLParse.Path = filepath.ToSlash(filepath.Join(targetURLParse.Path, filepath.Base(sourceContent.URL.Path)))
@@ -193,7 +193,7 @@ func prepareCopyURLsTypeC(ctx context.Context, sourceURL, targetURL string, isRe
}
// makeCopyContentTypeC - CopyURLs content for copying.
func makeCopyContentTypeC(sourceAlias string, sourceURL ClientURL, sourceContent *ClientContent, targetAlias string, targetURL string) URLs {
func makeCopyContentTypeC(sourceAlias string, sourceURL ClientURL, sourceContent *ClientContent, targetAlias, targetURL string) URLs {
newSourceURL := sourceContent.URL
pathSeparatorIndex := strings.LastIndex(sourceURL.Path, string(sourceURL.Separator))
newSourceSuffix := filepath.ToSlash(newSourceURL.Path)
+1 -1
View File
@@ -488,7 +488,7 @@ func mainIDPOpenIDEnable(ctx *cli.Context) error {
return idpEnableDisable(ctx, isOpenID, enable)
}
func idpEnableDisable(ctx *cli.Context, isOpenID bool, enable bool) error {
func idpEnableDisable(ctx *cli.Context, isOpenID, enable bool) error {
if len(ctx.Args()) < 1 || len(ctx.Args()) > 2 {
showCommandHelpAndExit(ctx, 1)
}
+1 -1
View File
@@ -93,7 +93,7 @@ func (t tierInfos) TableUI() *tview.Table {
return table
}
func (t tierInfos) Barcharts(tier string) (objects *tvxwidgets.BarChart, versions *tvxwidgets.BarChart) {
func (t tierInfos) Barcharts(tier string) (objects, versions *tvxwidgets.BarChart) {
var maxObj int
var maxVer int
for _, t := range t {
+1 -1
View File
@@ -119,7 +119,7 @@ func performLicenseRenew(alias string) licUpdateMessage {
}
}
func performLicenseUpdate(licFile string, alias string) licUpdateMessage {
func performLicenseUpdate(licFile, alias string) licUpdateMessage {
lum := licUpdateMessage{
Alias: alias,
Status: "success",
+1 -1
View File
@@ -214,7 +214,7 @@ type mirrorOptions struct {
}
// Prepares urls that need to be copied or removed based on requested options.
func prepareMirrorURLs(ctx context.Context, sourceURL string, targetURL string, opts mirrorOptions) <-chan URLs {
func prepareMirrorURLs(ctx context.Context, sourceURL, targetURL string, opts mirrorOptions) <-chan URLs {
URLsCh := make(chan URLs)
go deltaSourceTarget(ctx, sourceURL, targetURL, opts, URLsCh)
return URLsCh
+1 -1
View File
@@ -121,7 +121,7 @@ func getOdUrls(ctx context.Context, args argKVS) (odURLs URLs, e error) {
return odURLs, nil
}
func prepareOdUrls(ctx context.Context, sourceURL, sourceVersion string, targetURL string) URLs {
func prepareOdUrls(ctx context.Context, sourceURL, sourceVersion, targetURL string) URLs {
// Extract alias before fiddling with the clientURL.
sourceAlias, _, _ := mustExpandAlias(sourceURL)
// Find alias and expanded clientURL.
+1 -1
View File
@@ -180,7 +180,7 @@ func odCopy(ctx context.Context, odURLs URLs, args argKVS, odType string) (odMes
}
// odSetParts sets parts for object download.
func odSetParts(args argKVS) (parts int, skip int, e error) {
func odSetParts(args argKVS) (parts, skip int, e error) {
if args.Get("size") != "" {
return 0, 0, fmt.Errorf("size cannot be specified getting from server")
}
+1 -1
View File
@@ -35,7 +35,7 @@ import "github.com/rjeczalik/notify"
// BenchmarkPipeChan1K-4 100000 550623 ns/op
// PipeChan builds a new dynamically sized channel
func PipeChan(capacity int) (inputCh chan notify.EventInfo, outputCh chan notify.EventInfo) {
func PipeChan(capacity int) (inputCh, outputCh chan notify.EventInfo) {
// A set of channels which store all elements received from input
channels := make(chan chan notify.EventInfo, 1000)
+1 -1
View File
@@ -234,7 +234,7 @@ func newKeyMap() keyMap {
}
}
func initReplicateBacklogUI(arn string, op string, diffCh interface{}) *replicateBacklogUI {
func initReplicateBacklogUI(arn, op string, diffCh interface{}) *replicateBacklogUI {
s := spinner.New()
s.Spinner = spinner.Points
s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205"))
+1 -1
View File
@@ -55,7 +55,7 @@ func newShareDBV1() *shareDBV1 {
}
// Set upload info for each share.
func (s *shareDBV1) Set(objectURL string, shareURL string, expiry time.Duration, contentType string) {
func (s *shareDBV1) Set(objectURL, shareURL string, expiry time.Duration, contentType string) {
s.mutex.Lock()
defer s.mutex.Unlock()
+1 -1
View File
@@ -135,7 +135,7 @@ func makeCurlCmd(key, postURL string, isRecursive bool, uploadInfo map[string]st
}
// save shared URL to disk.
func saveSharedURL(objectURL string, shareURL string, expiry time.Duration, contentType string) *probe.Error {
func saveSharedURL(objectURL, shareURL string, expiry time.Duration, contentType string) *probe.Error {
// Load previously saved upload-shares.
shareDB := newShareDBV1()
if err := shareDB.Load(getShareUploadsFile()); err != nil {
+20 -18
View File
@@ -50,16 +50,18 @@ const (
)
var (
// https://subnet.min.io/downloads/license-pubkey.pem
subnetPublicKeyProd = `-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEaK31xujr6/rZ7ZfXZh3SlwovjC+X8wGq
qkltaKyTLRENd4w3IRktYYCRgzpDLPn/nrf7snV/ERO5qcI7fkEES34IVEr+2Uff
JkO2PfyyAYEO/5dBlPh1Undu9WQl6J7B
-----END PUBLIC KEY-----` // https://subnet.min.io/downloads/license-pubkey.pem
-----END PUBLIC KEY-----`
// https://localhost:9000/downloads/license-pubkey.pem
subnetPublicKeyDev = `-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEbo+e1wpBY4tBq9AONKww3Kq7m6QP/TBQ
mr/cKCUyBL7rcAvg0zNq1vcSrUSGlAmY3SEDCu3GOKnjG/U4E7+p957ocWSV+mQU
9NKlTdQFGF3+aO6jbQ4hX/S5qPyF+a3z
-----END PUBLIC KEY-----` // https://localhost:9000/downloads/license-pubkey.pem
-----END PUBLIC KEY-----`
subnetCommonFlags = append(supportGlobalFlags, cli.StringFlag{
Name: "api-key",
Usage: "API Key of the account on SUBNET",
@@ -90,7 +92,7 @@ func subnetLogWebhookURL() string {
return subnetBaseURL() + "/api/logs"
}
func subnetUploadURL(uploadType string, filename string) string {
func subnetUploadURL(uploadType, filename string) string {
return fmt.Sprintf("%s/api/%s/upload?filename=%s", subnetBaseURL(), uploadType, filename)
}
@@ -130,7 +132,7 @@ func checkURLReachable(url string) *probe.Error {
return nil
}
func subnetURLWithAuth(reqURL string, apiKey string) (string, map[string]string, error) {
func subnetURLWithAuth(reqURL, apiKey string) (string, map[string]string, error) {
if len(apiKey) == 0 {
// API key not available in minio/mc config.
// Ask the user to log in to get auth token
@@ -258,7 +260,7 @@ func getMinIOSubnetConfig(alias string) []madmin.SubsysConfig {
return globalSubnetConfig
}
func getKeyFromSubnetConfig(alias string, key string) (string, bool) {
func getKeyFromSubnetConfig(alias, key string) (string, bool) {
scfg := getMinIOSubnetConfig(alias)
// This function only works for fetch config from single target sub-systems
@@ -341,7 +343,7 @@ func minioConfigSupportsSubSys(client *madmin.AdminClient, subSys string) bool {
return false
}
func setSubnetAPIKeyInMcConfig(alias string, apiKey string) {
func setSubnetAPIKeyInMcConfig(alias, apiKey string) {
aliasCfg := mcConfig().Aliases[alias]
if len(apiKey) > 0 {
aliasCfg.APIKey = apiKey
@@ -350,7 +352,7 @@ func setSubnetAPIKeyInMcConfig(alias string, apiKey string) {
setAlias(alias, aliasCfg)
}
func setSubnetLicenseInMcConfig(alias string, lic string) {
func setSubnetLicenseInMcConfig(alias, lic string) {
aliasCfg := mcConfig().Aliases[alias]
if len(lic) > 0 {
aliasCfg.License = lic
@@ -358,7 +360,7 @@ func setSubnetLicenseInMcConfig(alias string, lic string) {
setAlias(alias, aliasCfg)
}
func setSubnetConfig(alias string, subKey string, cfgVal string) {
func setSubnetConfig(alias, subKey, cfgVal string) {
client, err := newAdminClient(alias)
fatalIf(err, "Unable to initialize admin connection.")
@@ -367,7 +369,7 @@ func setSubnetConfig(alias string, subKey string, cfgVal string) {
fatalIf(probe.NewError(e), "Unable to set "+cfgKey+" config on MinIO")
}
func setSubnetAPIKey(alias string, apiKey string) {
func setSubnetAPIKey(alias, apiKey string) {
if len(apiKey) == 0 {
fatal(errDummy().Trace(), "API Key must not be empty.")
}
@@ -381,7 +383,7 @@ func setSubnetAPIKey(alias string, apiKey string) {
setSubnetConfig(alias, "api_key", apiKey)
}
func setSubnetLicense(alias string, lic string) {
func setSubnetLicense(alias, lic string) {
if len(lic) == 0 {
fatal(errDummy().Trace(), "License must not be empty.")
}
@@ -552,7 +554,7 @@ func getSubnetAPIKeyUsingAuthHeaders(authHeaders map[string]string) (string, err
return extractSubnetCred("api_key", gjson.Parse(resp))
}
func getSubnetLicenseUsingAPIKey(alias string, apiKey string) (string, error) {
func getSubnetLicenseUsingAPIKey(alias, apiKey string) (string, error) {
regInfo := getClusterRegInfo(getAdminInfo(alias), alias)
_, lic, e := registerClusterOnSubnet(regInfo, alias, apiKey)
return lic, e
@@ -560,7 +562,7 @@ func getSubnetLicenseUsingAPIKey(alias string, apiKey string) (string, error) {
// registerClusterOnSubnet - Registers the given cluster on SUBNET using given API key for auth
// If the API key is empty, user will be asked to log in using SUBNET credentials.
func registerClusterOnSubnet(clusterRegInfo ClusterRegistrationInfo, alias string, apiKey string) (string, string, error) {
func registerClusterOnSubnet(clusterRegInfo ClusterRegistrationInfo, alias, apiKey string) (string, string, error) {
regURL, headers, e := subnetURLWithAuth(subnetRegisterURL(), apiKey)
if e != nil {
return "", "", e
@@ -586,7 +588,7 @@ func removeSubnetAuthConfig(alias string) {
}
// unregisterClusterFromSubnet - Unregisters the given cluster from SUBNET using given API key for auth
func unregisterClusterFromSubnet(depID string, apiKey string) error {
func unregisterClusterFromSubnet(depID, apiKey string) error {
regURL, headers, e := subnetURLWithAuth(subnetUnregisterURL(depID), apiKey)
if e != nil {
return e
@@ -599,7 +601,7 @@ func unregisterClusterFromSubnet(depID string, apiKey string) error {
// validateAndSaveLic - validates the given license in minio config
// If the license contains api key and the saveApiKey arg is true,
// api key is also saved in the minio config
func validateAndSaveLic(lic string, alias string, saveAPIKey bool) string {
func validateAndSaveLic(lic, alias string, saveAPIKey bool) string {
li, e := parseLicense(lic)
fatalIf(probe.NewError(e), "Error parsing license")
@@ -620,7 +622,7 @@ func validateAndSaveLic(lic string, alias string, saveAPIKey bool) string {
}
// extractAndSaveSubnetCreds - extract license from response and set it in minio config
func extractAndSaveSubnetCreds(alias string, resp string) (string, string, error) {
func extractAndSaveSubnetCreds(alias, resp string) (string, string, error) {
parsedResp := gjson.Parse(resp)
lic, e := extractSubnetCred("license", parsedResp)
@@ -696,7 +698,7 @@ func parseLicense(license string) (*licverifier.LicenseInfo, error) {
return &li, e
}
func prepareSubnetUploadURL(uploadURL string, alias string, apiKey string) (string, map[string]string) {
func prepareSubnetUploadURL(uploadURL, alias, apiKey string) (string, map[string]string) {
var e error
if len(apiKey) == 0 {
// api key not passed as flag. check if it's available in the config
@@ -710,7 +712,7 @@ func prepareSubnetUploadURL(uploadURL string, alias string, apiKey string) (stri
return reqURL, headers
}
func uploadFileToSubnet(alias string, filename string, reqURL string, headers map[string]string) (string, error) {
func uploadFileToSubnet(alias, filename, reqURL string, headers map[string]string) (string, error) {
req, e := subnetUploadReq(reqURL, filename)
if e != nil {
return "", e
@@ -731,7 +733,7 @@ func uploadFileToSubnet(alias string, filename string, reqURL string, headers ma
return resp, e
}
func subnetUploadReq(url string, filename string) (*http.Request, error) {
func subnetUploadReq(url, filename string) (*http.Request, error) {
r, w := io.Pipe()
mwriter := multipart.NewWriter(w)
contentType := mwriter.FormDataContentType()
+5 -5
View File
@@ -163,7 +163,7 @@ func mainCallhome(ctx *cli.Context) error {
return nil
}
func parseCallhomeFlags(ctx *cli.Context) (diag bool, logs bool) {
func parseCallhomeFlags(ctx *cli.Context) (diag, logs bool) {
diag = ctx.Bool("diag")
logs = ctx.Bool("logs")
@@ -176,7 +176,7 @@ func parseCallhomeFlags(ctx *cli.Context) (diag bool, logs bool) {
return diag, logs
}
func printCallhomeStatus(alias string, diag bool, logs bool) {
func printCallhomeStatus(alias string, diag, logs bool) {
resultMsg := supportCallhomeMessage{Action: "status"}
if diag {
resultMsg.Diag = featureStatusStr(isDiagCallhomeEnabled(alias))
@@ -188,7 +188,7 @@ func printCallhomeStatus(alias string, diag bool, logs bool) {
printMsg(resultMsg)
}
func toggleCallhome(alias string, apiKey string, enable bool, diag bool, logs bool) {
func toggleCallhome(alias, apiKey string, enable, diag, logs bool) {
newStatus := featureStatusStr(enable)
resultMsg := supportCallhomeMessage{
Action: newStatus,
@@ -208,7 +208,7 @@ func toggleCallhome(alias string, apiKey string, enable bool, diag bool, logs bo
printMsg(resultMsg)
}
func getFeature(diag bool, logs bool) string {
func getFeature(diag, logs bool) string {
if diag && logs {
return "Diagnostics and logs callhome"
}
@@ -238,7 +238,7 @@ func setCallhomeConfig(alias string, enableCallhome bool) {
fatalIf(probe.NewError(e), "Unable to set callhome config on minio")
}
func configureSubnetWebhook(alias string, apiKey string, enable bool) {
func configureSubnetWebhook(alias, apiKey string, enable bool) {
// Create a new MinIO Admin Client
client, err := newAdminClient(alias)
fatalIf(err, "Unable to initialize admin connection.")
+3 -3
View File
@@ -90,7 +90,7 @@ func checkSupportDiagSyntax(ctx *cli.Context) {
}
// compress and tar MinIO diagnostics output
func tarGZ(healthInfo interface{}, version string, filename string) error {
func tarGZ(healthInfo interface{}, version, filename string) error {
f, e := os.OpenFile(filename, os.O_CREATE|os.O_RDWR, 0o666)
if e != nil {
return e
@@ -164,7 +164,7 @@ func mainSupportDiag(ctx *cli.Context) error {
return nil
}
func execSupportDiag(ctx *cli.Context, client *madmin.AdminClient, alias string, apiKey string) {
func execSupportDiag(ctx *cli.Context, client *madmin.AdminClient, alias, apiKey string) {
var reqURL string
var headers map[string]string
@@ -224,7 +224,7 @@ func fetchServerDiagInfo(ctx *cli.Context, client *madmin.AdminClient) (interfac
startSpinner := func(s string) func() {
ctx, cancel := context.WithCancel(cont)
printText := func(t string, sp string, rewind int) {
printText := func(t, sp string, rewind int) {
console.RewindLines(rewind)
dot := infoText(dot)
+3 -3
View File
@@ -437,7 +437,7 @@ func convertPerfResults(results []PerfTestResult) PerfTestOutput {
return out
}
func execSupportPerf(ctx *cli.Context, aliasedURL string, perfType string) {
func execSupportPerf(ctx *cli.Context, aliasedURL, perfType string) {
alias, apiKey := initSubnetConnectivity(ctx, aliasedURL, true)
if len(apiKey) == 0 {
// api key not passed as flag. Check that the cluster is registered.
@@ -481,14 +481,14 @@ func execSupportPerf(ctx *cli.Context, aliasedURL string, perfType string) {
}
}
func savePerfResultFile(tmpFileName string, resultFileNamePfx string) {
func savePerfResultFile(tmpFileName, resultFileNamePfx string) {
zipFileName := resultFileNamePfx + ".zip"
e := moveFile(tmpFileName, zipFileName)
fatalIf(probe.NewError(e), fmt.Sprintf("Unable to move %s -> %s", tmpFileName, zipFileName))
console.Infof("MinIO performance report saved at %s, please upload to SUBNET portal manually\n", zipFileName)
}
func runPerfTests(ctx *cli.Context, aliasedURL string, perfType string) []PerfTestResult {
func runPerfTests(ctx *cli.Context, aliasedURL, perfType string) []PerfTestResult {
resultCh := make(chan PerfTestResult)
results := []PerfTestResult{}
defer close(resultCh)
+1 -1
View File
@@ -183,7 +183,7 @@ func mainSupportProfile(ctx *cli.Context) error {
return nil
}
func execSupportProfile(ctx *cli.Context, client *madmin.AdminClient, alias string, apiKey string) {
func execSupportProfile(ctx *cli.Context, client *madmin.AdminClient, alias, apiKey string) {
var reqURL string
var headers map[string]string
profilers := ctx.String("type")
+1 -1
View File
@@ -128,7 +128,7 @@ func validateClusterRegistered(alias string, cmdTalksToSubnet bool) string {
// - given subsystem is not supported by the version of MinIO
// - the given target doesn't exist in the config
// - `enable` is set to `off`
func isFeatureEnabled(alias string, subSys string, target string) bool {
func isFeatureEnabled(alias, subSys, target string) bool {
client, err := newAdminClient(alias)
// Create a new MinIO Admin Client
fatalIf(err, "Unable to initialize admin connection.")
+1 -1
View File
@@ -147,7 +147,7 @@ func (t tagListMessage) String() string {
}
// parseTagListSyntax performs command-line input validation for tag list command.
func parseTagListSyntax(ctx *cli.Context) (targetURL, versionID string, timeRef time.Time, withOlderVersions bool, recursive bool) {
func parseTagListSyntax(ctx *cli.Context) (targetURL, versionID string, timeRef time.Time, withOlderVersions, recursive bool) {
if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, globalErrorExitStatus)
}
+1 -1
View File
@@ -113,7 +113,7 @@ func (t tagRemoveMessage) JSON() string {
return string(msgBytes)
}
func parseRemoveTagSyntax(ctx *cli.Context) (targetURL, versionID string, timeRef time.Time, withVersions bool, recursive bool) {
func parseRemoveTagSyntax(ctx *cli.Context) (targetURL, versionID string, timeRef time.Time, withVersions, recursive bool) {
if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, globalErrorExitStatus)
}
+3 -3
View File
@@ -311,7 +311,7 @@ func getLatestReleaseTime(customReleaseURL string, timeout time.Duration) (sha25
return parseReleaseData(data)
}
func getDownloadURL(customReleaseURL string, releaseTag string) (downloadURL string) {
func getDownloadURL(customReleaseURL, releaseTag string) (downloadURL string) {
// Check if we are docker environment, return docker update command
if IsDocker() {
// Construct release tag name.
@@ -331,7 +331,7 @@ func getDownloadURL(customReleaseURL string, releaseTag string) (downloadURL str
return u.String()
}
func getUpdateInfo(customReleaseURL string, timeout time.Duration) (updateMsg string, sha256Hex string, currentReleaseTime, latestReleaseTime time.Time, releaseTag string, err *probe.Error) {
func getUpdateInfo(customReleaseURL string, timeout time.Duration) (updateMsg, sha256Hex string, currentReleaseTime, latestReleaseTime time.Time, releaseTag string, err *probe.Error) {
currentReleaseTime, err = GetCurrentReleaseTime()
if err != nil {
return updateMsg, sha256Hex, currentReleaseTime, latestReleaseTime, releaseTag, err.Trace()
@@ -422,7 +422,7 @@ func getUpdateReaderFromURL(u *url.URL, transport http.RoundTripper) (io.ReadClo
return newProgressReader(resp.Body, "mc", resp.ContentLength), nil
}
func doUpdate(customReleaseURL string, sha256Hex string, latestReleaseTime time.Time, releaseTag string, ok bool) (updateStatusMsg string, err *probe.Error) {
func doUpdate(customReleaseURL, sha256Hex string, latestReleaseTime time.Time, releaseTag string, ok bool) (updateStatusMsg string, err *probe.Error) {
fmtReleaseTime := latestReleaseTime.Format(mcReleaseTagTimeLayout)
if !ok {
updateStatusMsg = colorGreenBold("mc update to version %s canceled.",
+1 -1
View File
@@ -45,7 +45,7 @@ func prepareUpdateMessage(downloadURL string, older time.Duration) string {
}
// colorizeUpdateMessage - inspired from Yeoman project npm package https://github.com/yeoman/update-notifier
func colorizeUpdateMessage(updateString string, newerThan string) string {
func colorizeUpdateMessage(updateString, newerThan string) string {
msgLine1Fmt := " You are running an older version of mc released %s "
msgLine2Fmt := " Update: %s "
+1 -1
View File
@@ -212,7 +212,7 @@ type prefixSSEPair struct {
}
// parse and validate encryption keys entered on command line
func parseAndValidateEncryptionKeys(sseKeys string, sse string) (encMap map[string][]prefixSSEPair, err *probe.Error) {
func parseAndValidateEncryptionKeys(sseKeys, sse string) (encMap map[string][]prefixSSEPair, err *probe.Error) {
encMap, err = parseEncryptionKeys(sseKeys)
if err != nil {
return nil, err