goharbor / goharbor/harbor-cli

[bug]: project member update prints incorrect role ID in success message

Open Beginner friendly
#1,063 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
163
Forks
211
Avg merge
1m
Merged PRs (30d)
1

Description

## Description

The `project member update` command prints an incorrect role ID in its success message after successfully updating a project member.

The success message formats a `*models.RoleRequest` value using the `%d` formatting verb instead of printing the numeric role ID.

## Steps to Reproduce

1. Configure Harbor CLI with a working Harbor instance.
2. Run command:
```bash
harbor project member update --roleid 2
```
3. Observe the success message after the update completes successfully.

## Expected Behavior

The success message should display the numeric role ID.

Example:

```text
successfully updated user with ID 1 with role ID 2 for project my-project
```

## Actual Behavior

The success message attempts to format a `*models.RoleRequest` using `%d`, resulting in incorrect output instead of the numeric role ID.

Example:

```text
successfully updated user with ID 1 with role ID %!d(*models.RoleRequest=...) for project my-project
```

## Environment

- OS: Windows
- Tool version: Current `main` branch
- Other relevant details: Issue located in `cmd/harbor/root/project/member/update.go`

## Additional Context

The success message currently passes `opts.RoleID` (type `*models.RoleRequest`) to `fmt.Printf` using the `%d` format verb. The success message should print the numeric role ID instead.

Contributor guide

Open the contributing guide

Research direction

Start in cmd/harbor/root/project/member/update.go and inspect the success message after the project member update completes. Reproduce the command with --roleid 2, then verify the message displays the numeric role ID 2 instead of the formatting error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.