Fix lint errors and bump golangci-lint to v2/action v9
CI / Test (linux/amd64) (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Cross-build (darwin/amd64) (push) Waiting to run
CI / Cross-build (linux/amd64) (push) Waiting to run
CI / Cross-build (darwin/arm64) (push) Waiting to run
CI / Cross-build (linux/arm64) (push) Waiting to run
CI / Test (linux/amd64) (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Cross-build (darwin/amd64) (push) Waiting to run
CI / Cross-build (linux/amd64) (push) Waiting to run
CI / Cross-build (darwin/arm64) (push) Waiting to run
CI / Cross-build (linux/arm64) (push) Waiting to run
- Migrate .golangci.yml to golangci-lint v2 config format - Bump golangci-lint-action from v6 (Node 20, deprecated) to v9 (Node 24) - Fix errcheck: check fmt.Fscanln and fmt.Sscanf return values - Fix ineffassign: replace unused vars with _ in test files - Fix revive unused-parameter: rename unused cmd/args/r/c params to _ - Fix revive empty-block: invert if condition in push command - Fix revive redefines-builtin-id: rename 'clear' to 'clearsigned' - Fix revive blank-imports: add comment on modernc.org/sqlite import - Fix unused: remove unused 'suite' and 'gen' fields from cache entry
This commit is contained in:
@@ -16,7 +16,7 @@ func (r *Root) aptConfigCmd() *cobra.Command {
|
||||
Use: "apt-config <repo> <distro>",
|
||||
Short: "Print apt client configuration (sources.list, key, and auth) for a repository",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
repoName, dist := args[0], args[1]
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
|
||||
@@ -15,7 +15,7 @@ func (r *Root) loginCmd() *cobra.Command {
|
||||
Use: "login [server]",
|
||||
Short: "Log in to a urapt server and save an API token",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
server := r.flagServer
|
||||
if len(args) == 1 {
|
||||
server = args[0]
|
||||
@@ -65,7 +65,7 @@ func (r *Root) logoutCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "logout",
|
||||
Short: "Revoke the current API token and clear the saved profile",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -86,7 +86,7 @@ func (r *Root) whoamiCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "whoami",
|
||||
Short: "Show the currently authenticated user",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -111,7 +111,7 @@ func (r *Root) registerCmd() *cobra.Command {
|
||||
Use: "register [server]",
|
||||
Short: "Create a new account on a urapt server (first account becomes admin)",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
server := r.flagServer
|
||||
if len(args) == 1 {
|
||||
server = args[0]
|
||||
@@ -175,7 +175,7 @@ func (r *Root) tokenCreateCmd() *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: "create",
|
||||
Short: "Create a new API token",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
client, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -202,7 +202,7 @@ func (r *Root) tokenListCmd() *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List your API tokens",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
client, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -238,7 +238,7 @@ func (r *Root) tokenRevokeCmd() *cobra.Command {
|
||||
Use: "revoke <id>",
|
||||
Short: "Revoke an API token by id",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
client, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -18,7 +18,7 @@ func (r *Root) pushCmd() *cobra.Command {
|
||||
Use: "push <repo> <distro> <component> <file.deb>",
|
||||
Short: "Upload a .deb package to a repository",
|
||||
Args: cobra.ExactArgs(4),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
repo, dist, component, file := args[0], args[1], args[2], args[3]
|
||||
|
||||
// Local pre-validation for early, clear errors.
|
||||
@@ -31,9 +31,7 @@ func (r *Root) pushCmd() *cobra.Command {
|
||||
if archOverride != "" {
|
||||
arch = archOverride
|
||||
}
|
||||
if r.flagJSON {
|
||||
// no-op: keep flag accepted
|
||||
} else {
|
||||
if !r.flagJSON {
|
||||
fmt.Printf("Pushing %s_%s_%s (%d bytes)\n", pkgName, ver, arch, inspected.Size)
|
||||
}
|
||||
|
||||
@@ -66,7 +64,7 @@ func (r *Root) lsCmd() *cobra.Command {
|
||||
Use: "ls <repo> <distro>",
|
||||
Short: "List packages in a repository/distribution",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -106,7 +104,7 @@ func (r *Root) showCmd() *cobra.Command {
|
||||
Use: "show <repo> <id|name[@version][:arch]>",
|
||||
Short: "Show package metadata",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -137,7 +135,7 @@ func (r *Root) pullCmd() *cobra.Command {
|
||||
Use: "pull <repo> <id|name[@version][:arch]>",
|
||||
Short: "Download a package's .deb file",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -174,7 +172,7 @@ func (r *Root) rmCmd() *cobra.Command {
|
||||
Use: "rm <repo> <id|name[@version][:arch]>",
|
||||
Short: "Delete a package",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+10
-10
@@ -33,7 +33,7 @@ func (r *Root) repoCreateCmd() *cobra.Command {
|
||||
Use: "create <name>",
|
||||
Short: "Create a new repository",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
vis := visibility
|
||||
if public {
|
||||
vis = "public"
|
||||
@@ -70,7 +70,7 @@ func (r *Root) repoListCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List repositories visible to you",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -101,7 +101,7 @@ func (r *Root) repoInfoCmd() *cobra.Command {
|
||||
Use: "info <name>",
|
||||
Short: "Show details of a repository",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -129,7 +129,7 @@ func (r *Root) repoSetVisibilityCmd() *cobra.Command {
|
||||
Use: "set-visibility <name>",
|
||||
Short: "Change a repository's visibility",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
vis := ""
|
||||
if public {
|
||||
vis = "public"
|
||||
@@ -165,7 +165,7 @@ func (r *Root) repoDeleteCmd() *cobra.Command {
|
||||
Use: "delete <name>",
|
||||
Short: "Delete a repository and all its packages",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -185,7 +185,7 @@ func (r *Root) repoPubkeyCmd() *cobra.Command {
|
||||
Use: "pubkey <name>",
|
||||
Short: "Print the server's armored public key for a repository",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -224,7 +224,7 @@ func (r *Root) repoMembersListCmd() *cobra.Command {
|
||||
Use: "list <repo>",
|
||||
Short: "List members of a repository",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -252,7 +252,7 @@ func (r *Root) repoMembersAddCmd() *cobra.Command {
|
||||
Use: "add <repo> <username>",
|
||||
Short: "Grant a user access to a repository",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -279,7 +279,7 @@ func (r *Root) repoMembersUpdateCmd() *cobra.Command {
|
||||
Use: "update <repo> <username>",
|
||||
Short: "Change a member's access level",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -305,7 +305,7 @@ func (r *Root) repoMembersRemoveCmd() *cobra.Command {
|
||||
Use: "remove <repo> <username>",
|
||||
Short: "Revoke a user's access to a repository",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -22,7 +22,7 @@ func (r *Root) distroCreateCmd() *cobra.Command {
|
||||
Use: "create <repo> <distro>",
|
||||
Short: "Add a distribution to a repository",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -46,7 +46,7 @@ func (r *Root) distroListCmd() *cobra.Command {
|
||||
Use: "list <repo>",
|
||||
Short: "List distributions in a repository",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -72,7 +72,7 @@ func (r *Root) distroDeleteCmd() *cobra.Command {
|
||||
Use: "delete <repo> <distro>",
|
||||
Short: "Delete a distribution and its packages",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -100,7 +100,7 @@ func (r *Root) componentCreateCmd() *cobra.Command {
|
||||
Use: "create <repo> <distro> <component>",
|
||||
Short: "Add a component to a distribution",
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -124,7 +124,7 @@ func (r *Root) componentListCmd() *cobra.Command {
|
||||
Use: "list <repo> <distro>",
|
||||
Short: "List components in a distribution",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -150,7 +150,7 @@ func (r *Root) componentDeleteCmd() *cobra.Command {
|
||||
Use: "delete <repo> <distro> <component>",
|
||||
Short: "Delete a component",
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -178,7 +178,7 @@ func (r *Root) archAddCmd() *cobra.Command {
|
||||
Use: "add <repo> <distro> <arch>",
|
||||
Short: "Add an architecture to a distribution",
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -202,7 +202,7 @@ func (r *Root) archListCmd() *cobra.Command {
|
||||
Use: "list <repo> <distro>",
|
||||
Short: "List architectures in a distribution",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -228,7 +228,7 @@ func (r *Root) archRemoveCmd() *cobra.Command {
|
||||
Use: "remove <repo> <distro> <arch>",
|
||||
Short: "Remove an architecture from a distribution",
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
c, err := r.client()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -10,7 +10,7 @@ func (r *Root) versionCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the urapt CLI version",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
fmt.Println(r.version)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ func ReadLine(prompt string) (string, error) {
|
||||
func Confirm(prompt string) bool {
|
||||
fmt.Fprintf(os.Stderr, "%s [y/N]: ", prompt)
|
||||
var s string
|
||||
fmt.Fscanln(os.Stdin, &s)
|
||||
_, _ = fmt.Fscanln(os.Stdin, &s)
|
||||
s = strings.ToLower(strings.TrimSpace(s))
|
||||
return s == "y" || s == "yes"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user