Skip to content

Commit 3b7752c

Browse files
committed
fix/added fixes recommended in copilot review
Signed-off-by: Rayyan Khan <rayyanrehman101@gmail.com>
1 parent 2efeb88 commit 3b7752c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

cmd/harbor/root/project/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func BuildListOptions(private, public bool, opts *api.ListFlags, fuzzy, match, r
5656
}
5757

5858
if private && public {
59-
return nil, fmt.Errorf("Cannot specify both --private and --public flags")
59+
return nil, fmt.Errorf("cannot specify both --private and --public flags")
6060
}
6161

6262
if private {
@@ -107,7 +107,7 @@ func ListProjectCommand() *cobra.Command {
107107
log.Debug("Fetching projects...")
108108
allProjects, err = fetchProjects(listFunc, opts)
109109
if err != nil {
110-
return fmt.Errorf("%s", utils.ParseHarborErrorMsg(err))
110+
return fmt.Errorf("failed to get projects list: %s", utils.ParseHarborErrorMsg(err))
111111
}
112112
if err := PrintProjects(allProjects); err != nil {
113113
return err

cmd/harbor/root/project/list_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
log "github.com/sirupsen/logrus"
3232
"github.com/spf13/viper"
3333
"github.com/stretchr/testify/assert"
34-
"go.yaml.in/yaml/v4"
34+
"gopkg.in/yaml.v2"
3535
)
3636

3737
func captureOutput(f func() error) (string, error) {
@@ -71,7 +71,7 @@ func (m *MockProjectLister) mockListFunc(opts ...api.ListFlags) (project.ListPro
7171
return *res, fmt.Errorf("mock list error")
7272
}
7373
if len(opts) == 0 {
74-
return *res, fmt.Errorf("No options passed")
74+
return *res, fmt.Errorf("no options passed")
7575
}
7676
listFlags := opts[0]
7777
page, pageSize := listFlags.Page, listFlags.PageSize
@@ -158,7 +158,7 @@ func TestBuildListOptions(t *testing.T) {
158158
opts: &api.ListFlags{},
159159
}
160160
},
161-
wantedErr: "Cannot specify both --private and --public",
161+
wantedErr: "cannot specify both --private and --public",
162162
},
163163
{
164164
name: "page size exceeds maximum",

pkg/views/project/list/view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func ListProjects(projects []*models.Project) error {
6161
m := tablelist.NewModel(columns, rows, len(rows))
6262

6363
if _, err := tea.NewProgram(m, tea.WithOutput(os.Stdout), tea.WithInput(nil)).Run(); err != nil {
64-
return fmt.Errorf("Error running program:%w", err)
64+
return fmt.Errorf("Error running program: %w", err)
6565
}
6666
return nil
6767
}

0 commit comments

Comments
 (0)