Skip to content
Open
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/harbor/root/artifact/label/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Supports output formatting such as JSON or YAML using the --output (-o) flag.`,
if len(args) > 0 {
return fmt.Errorf("Invalid artifact reference format: %s", args[0])
} else {
return fmt.Errorf("Invalid artifact reference format: no arguments provided")
return fmt.Errorf("invalid artifact reference format: no arguments provided")
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func ListProjectCommand() *cobra.Command {
}

if private && public {
return fmt.Errorf("Cannot specify both --private and --public flags")
return fmt.Errorf("cannot specify both --private and --public flags")
}

var listFunc func(...api.ListFlags) (project.ListProjectsOK, error)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/project/member/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func UpdateMemberCommand() *cobra.Command {
opts.ID = prompt.GetMemberIDFromUser(opts.ProjectNameOrID, memberName)

if opts.ID == 0 {
return fmt.Errorf("No members found in project")
return fmt.Errorf("no members found in project")
}
} else {
opts.ID, err = api.GetUsersIdByName(memberName)
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/robot/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func createRobotAndHandleResponse(opts *create.CreateView, exportToFile bool) er
if err != nil {
errorCode := utils.ParseHarborErrorCode(err)
if errorCode == "403" {
return fmt.Errorf("Permission denied: (Project) Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: (Project) Admin privileges are required to execute this command.")
} else {
return fmt.Errorf("failed to create robot: %v", utils.ParseHarborErrorMsg(err))
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/harbor/root/robot/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Examples:
if err != nil {
errorCode := utils.ParseHarborErrorCode(err)
if errorCode == "403" {
return fmt.Errorf("Permission denied: (Project) Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: (Project) Admin privileges are required to execute this command.")
} else {
return fmt.Errorf("failed to get robot: %v", utils.ParseHarborErrorMsg(err))
}
Expand All @@ -78,7 +78,7 @@ Examples:
if err != nil {
errorCode := utils.ParseHarborErrorCode(err)
if errorCode == "403" {
return fmt.Errorf("Permission denied: (Project) Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: (Project) Admin privileges are required to execute this command.")
} else {
return fmt.Errorf("failed to delete robot: %v", utils.ParseHarborErrorMsg(err))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/robot/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Examples:
if err != nil {
errorCode := utils.ParseHarborErrorCode(err)
if errorCode == "403" {
return fmt.Errorf("Permission denied: (Project) Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: (Project) Admin privileges are required to execute this command.")
} else {
return fmt.Errorf("failed to list robots: %v", utils.ParseHarborErrorMsg(err))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/robot/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Examples:
if err != nil {
errorCode := utils.ParseHarborErrorCode(err)
if errorCode == "403" {
return fmt.Errorf("Permission denied: (Project) Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: (Project) Admin privileges are required to execute this command.")
} else {
return fmt.Errorf("failed to get robot: %v", utils.ParseHarborErrorMsg(err))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/tag/retention/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Examples:
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if projectID != -1 && projectName != "" {
return fmt.Errorf("Cannot specify both --project-id and --project-name flags")
return fmt.Errorf("cannot specify both --project-id and --project-name flags")
}

if projectID == -1 && projectName == "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/tag/retention/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Examples:
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
if projectID != -1 && projectName != "" {
return fmt.Errorf("Cannot specify both --project-id and --project-name flags")
return fmt.Errorf("cannot specify both --project-id and --project-name flags")
}

if projectID == -1 && projectName == "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/user/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func UserCreateCmd() *cobra.Command {

if err != nil {
if isUnauthorizedError(err) {
return fmt.Errorf("Permission denied: Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: Admin privileges are required to execute this command.")
} else {
return fmt.Errorf("failed to create user: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/user/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func UserDeleteCmd() *cobra.Command {
}
if err := api.DeleteUser(userID); err != nil {
if isUnauthorizedError(err) {
return fmt.Errorf("Permission denied: Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: Admin privileges are required to execute this command.")
} else {
return fmt.Errorf("failed to delete user: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/harbor/root/user/elevate.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ func ElevateUser(args []string) error {
return err
}
if !confirm {
err = errors.New("User did not confirm elevation. Aborting command.")
err = errors.New("user did not confirm elevation. Aborting command.")
log.Error(err.Error())
return err
}

err = elevateUserAPI(userId)
if err != nil {
if isUnauthorizedError(err) {
err = errors.New("Permission denied: Admin privileges are required to execute this command.")
err = errors.New("permission denied: Admin privileges are required to execute this command.")
} else {
err = fmt.Errorf("failed to elevate user: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/harbor/root/user/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func UserListCmd() *cobra.Command {
response, err := api.ListUsers(opts)
if err != nil {
if isUnauthorizedError(err) {
return fmt.Errorf("Permission denied: Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: Admin privileges are required to execute this command.")
}
return fmt.Errorf("failed to list users: %v", err)
}
Expand All @@ -71,7 +71,7 @@ func UserListCmd() *cobra.Command {
response, err := api.ListUsers(opts)
if err != nil {
if isUnauthorizedError(err) {
return fmt.Errorf("Permission denied: Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: Admin privileges are required to execute this command.")
}
return fmt.Errorf("failed to list users: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/user/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func UserPasswordChangeCmd() *cobra.Command {
err = api.ResetPassword(userId, *resetView)
if err != nil {
if isUnauthorizedError(err) {
return fmt.Errorf("Permission denied: Admin privileges are required to execute this command.")
return fmt.Errorf("permission denied: Admin privileges are required to execute this command.")
} else {
return fmt.Errorf("failed to reset user password: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/quota_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,5 @@ func getRefProjectID(ref models.QuotaRefObject) (string, error) {
id, _ := refMap["id"]
return fmt.Sprintf("%v", id), nil
}
return "", fmt.Errorf("Error: Ref is not of expected type")
return "", fmt.Errorf("error: Ref is not of expected type")
}
2 changes: 1 addition & 1 deletion pkg/api/retention_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func GetRetentionId(projectNameorID string, isName bool) (string, error) {
}

if response.Payload.Metadata == nil || response.Payload.Metadata.RetentionID == nil {
return "", errors.New("No retention policy exists for this project")
return "", errors.New("no retention policy exists for this project")
}
retentionid := *response.Payload.Metadata.RetentionID

Expand Down
2 changes: 1 addition & 1 deletion pkg/views/member/create/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func CreateMemberView(createView *CreateView) {
Value(&createView.MemberUser.Username).
Validate(func(str string) error {
if str == "" {
return errors.New("Username cannot be empty.")
return errors.New("username cannot be empty.")
}

if !utils.ValidateUserName(str) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/views/quota/list/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func getRefDetails(ref models.QuotaRefObject) (string, string, error) {
ownerName, _ := refMap["owner_name"].(string)
return projectName, ownerName, nil
}
return "", "", fmt.Errorf("Error: Ref is not of expected type")
return "", "", fmt.Errorf("error: Ref is not of expected type")
}

// Function to convert bytes to human-readable storage format
Expand Down