Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run gofumpt -extra on all source files #4634

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/alias-set.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion cmd/auto-complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmd/client-fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 \.
Expand Down Expand Up @@ -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"})
Expand Down
10 changes: 5 additions & 5 deletions cmd/client-s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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})
}
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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{})
Expand Down
2 changes: 1 addition & 1 deletion cmd/client-url.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cmd/common-methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
}
2 changes: 1 addition & 1 deletion cmd/cp-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/cp-url-syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -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+"`.")

Expand Down
10 changes: 5 additions & 5 deletions cmd/cp-url.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand All @@ -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.
Expand All @@ -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)))
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/idp-openid-subcommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ilm-tier-info-ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/license-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion cmd/mirror-url.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/od-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cmd/od-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/pipechan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion cmd/replicate-backlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion cmd/share-db-v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion cmd/share-upload-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading
Loading