diff --git a/cmd/flag/common.go b/cmd/flag/common.go index d634c80..9256e5c 100644 --- a/cmd/flag/common.go +++ b/cmd/flag/common.go @@ -1,7 +1,6 @@ package flag import ( - "fmt" "os" irodsclient_config "github.com/cyverse/go-irodsclient/config" @@ -34,7 +33,7 @@ var ( ) func SetCommonFlags(command *cobra.Command, noResource bool) { - command.Flags().StringVarP(&commonFlagValues.ConfigFilePath, "config", "c", "", fmt.Sprintf("Set config file or directory (default %q)", commons.GetDefaultIRODSConfigPath())) + command.Flags().StringVarP(&commonFlagValues.ConfigFilePath, "config", "c", commons.GetDefaultIRODSConfigPath(), "Set config file or directory") command.Flags().BoolVarP(&commonFlagValues.ShowVersion, "version", "v", false, "Print version") command.Flags().BoolVarP(&commonFlagValues.ShowHelp, "help", "h", false, "Print help") command.Flags().BoolVarP(&commonFlagValues.DebugMode, "debug", "d", false, "Enable debug mode") diff --git a/commons/constant.go b/commons/constant.go index c147e9f..703cdea 100644 --- a/commons/constant.go +++ b/commons/constant.go @@ -7,11 +7,13 @@ import ( ) const ( + goCommandsRepoPackagePath string = "cyverse/gocommands" + ClientProgramName string = "gocommands" FilesystemTimeout irodsclient_types.Duration = irodsclient_types.Duration(10 * time.Minute) TransferThreadNumDefault int = 5 UploadThreadNumMax int = 20 - TCPBufferSizeDefault int = 4 * 1024 * 1024 - TCPBufferSizeStringDefault string = "4MB" + TCPBufferSizeDefault int = 1 * 1024 * 1024 + TCPBufferSizeStringDefault string = "1MB" RedirectToResourceMinSize int64 = 1024 * 1024 * 1024 // 1GB ) diff --git a/commons/upgrade.go b/commons/upgrade.go index 16fda43..1046322 100644 --- a/commons/upgrade.go +++ b/commons/upgrade.go @@ -18,13 +18,13 @@ func CheckNewRelease() (*selfupdate.Release, error) { logger.Infof("checking latest version for %s/%s", runtime.GOOS, runtime.GOARCH) - latest, found, err := selfupdate.DetectLatest(context.Background(), selfupdate.ParseSlug("cyverse/gocommands")) + latest, found, err := selfupdate.DetectLatest(context.Background(), selfupdate.ParseSlug(goCommandsRepoPackagePath)) if err != nil { return nil, xerrors.Errorf("error occurred while detecting version: %w", err) } if !found { - return nil, xerrors.Errorf("latest version for %s/%s could not be found from github repository 'cyverse/gocommands'", runtime.GOOS, runtime.GOARCH) + return nil, xerrors.Errorf("latest version for %s/%s is not found from github repository %q", runtime.GOOS, runtime.GOARCH, goCommandsRepoPackagePath) } return latest, nil @@ -38,13 +38,13 @@ func SelfUpgrade() error { logger.Infof("checking latest version for %s/%s", runtime.GOOS, runtime.GOARCH) - latest, found, err := selfupdate.DetectLatest(context.Background(), selfupdate.ParseSlug("cyverse/gocommands")) + latest, found, err := selfupdate.DetectLatest(context.Background(), selfupdate.ParseSlug(goCommandsRepoPackagePath)) if err != nil { return xerrors.Errorf("error occurred while detecting version: %w", err) } if !found { - return xerrors.Errorf("latest version for %s/%s could not be found from github repository 'cyverse/gocommands'", runtime.GOOS, runtime.GOARCH) + return xerrors.Errorf("latest version for %s/%s could not be found from github repository %q", runtime.GOOS, runtime.GOARCH, goCommandsRepoPackagePath) } myVersion := GetClientVersion()