Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint: Fix revive #632

Merged
merged 2 commits into from
Feb 13, 2025
Merged
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: 2 additions & 0 deletions cmd/microcloud/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type cmdAdd struct {
flagSessionTimeout int64
}

// Command returns the subcommand to add new systems to MicroCloud.
func (c *cmdAdd) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "add",
Expand All @@ -36,6 +37,7 @@ func (c *cmdAdd) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand to add new systems to MicroCloud.
func (c *cmdAdd) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down
6 changes: 6 additions & 0 deletions cmd/microcloud/cluster_members.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type cmdClusterMembers struct {
common *CmdControl
}

// Command returns the subcommand to manage cluster members.
func (c *cmdClusterMembers) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "cluster",
Expand All @@ -67,6 +68,7 @@ func (c *cmdClusterMembers) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand to manage cluster members.
func (c *cmdClusterMembers) Run(cmd *cobra.Command, args []string) error {
return cmd.Help()
}
Expand All @@ -78,6 +80,7 @@ type cmdClusterMembersList struct {
flagLocal bool
}

// Command returns the subcommand to list cluster members.
func (c *cmdClusterMembersList) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "list <address>",
Expand All @@ -91,6 +94,7 @@ func (c *cmdClusterMembersList) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand to list cluster members.
func (c *cmdClusterMembersList) Run(cmd *cobra.Command, args []string) error {
if len(args) > 1 {
return cmd.Help()
Expand Down Expand Up @@ -183,6 +187,7 @@ type cmdClusterMemberRemove struct {
flagForce bool
}

// Command returns the subcommand to remove a cluster member.
func (c *cmdClusterMemberRemove) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "remove <name>",
Expand All @@ -195,6 +200,7 @@ func (c *cmdClusterMemberRemove) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand to remove a cluster member.
func (c *cmdClusterMemberRemove) Run(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return cmd.Help()
Expand Down
2 changes: 2 additions & 0 deletions cmd/microcloud/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type cmdJoin struct {
flagInitiatorAddress string
}

// Command returns the subcommand for joining a MicroCloud.
func (c *cmdJoin) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "join",
Expand All @@ -36,6 +37,7 @@ func (c *cmdJoin) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for joining a MicroCloud.
func (c *cmdJoin) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down
3 changes: 3 additions & 0 deletions cmd/microcloud/main_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ type cmdInit struct {
flagSessionTimeout int64
}

// Command returns the subcommand for initializing a MicroCloud.
func (c *cmdInit) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "init",
Expand All @@ -136,6 +137,7 @@ func (c *cmdInit) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for initializing a MicroCloud.
func (c *cmdInit) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand All @@ -158,6 +160,7 @@ func (c *cmdInit) Run(cmd *cobra.Command, args []string) error {
return cfg.RunInteractive(cmd, args)
}

// RunInteractive runs the interactive subcommand for initializing a MicroCloud.
func (c *initConfig) RunInteractive(cmd *cobra.Command, args []string) error {
fmt.Println("Waiting for services to start ...")
err := checkInitialized(c.common.FlagMicroCloudDir, false, false)
Expand Down
2 changes: 2 additions & 0 deletions cmd/microcloud/preseed.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ type cmdPreseed struct {
common *CmdControl
}

// Command returns the subcommand for unattended cluster initialization.
func (c *cmdPreseed) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "preseed",
Expand All @@ -124,6 +125,7 @@ func (c *cmdPreseed) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for unattended cluster initialization.
func (c *cmdPreseed) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down
2 changes: 2 additions & 0 deletions cmd/microcloud/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type cmdRemove struct {
flagForce bool
}

// Command returns the subcommand to remove a member from all MicroCloud services.
func (c *cmdRemove) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "remove <name>",
Expand All @@ -29,6 +30,7 @@ func (c *cmdRemove) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand to remove a member from all MicroCloud services.
func (c *cmdRemove) Run(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return cmd.Help()
Expand Down
5 changes: 5 additions & 0 deletions cmd/microcloud/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type cmdServices struct {
common *CmdControl
}

// Command returns the subcommand to manage MicroCloud services.
func (c *cmdServices) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "service",
Expand All @@ -46,6 +47,7 @@ type cmdServiceList struct {
common *CmdControl
}

// Command returns the subcommand to list MicroCloud services.
func (c *cmdServiceList) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Expand All @@ -56,6 +58,7 @@ func (c *cmdServiceList) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand to list MicroCloud services.
func (c *cmdServiceList) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down Expand Up @@ -195,6 +198,7 @@ type cmdServiceAdd struct {
common *CmdControl
}

// Command returns the subcommand to add services to MicroCloud.
func (c *cmdServiceAdd) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "add",
Expand All @@ -205,6 +209,7 @@ func (c *cmdServiceAdd) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand to add services to MicroCloud.
func (c *cmdServiceAdd) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down
1 change: 1 addition & 0 deletions cmd/microcloud/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/canonical/microcloud/microcloud/service"
)

// SessionFunc represents a function executed throughout the lifetime of a session.
type SessionFunc func(gw *cloudClient.WebsocketGateway) error

func (c *initConfig) runSession(ctx context.Context, s *service.Handler, role types.SessionRole, timeout time.Duration, f SessionFunc) error {
Expand Down
2 changes: 2 additions & 0 deletions cmd/microcloud/shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type cmdShutdown struct {
common *CmdControl
}

// Command returns the subcommand for shutting down the MicroCloud daemon.
func (c *cmdShutdown) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "shutdown",
Expand All @@ -22,6 +23,7 @@ func (c *cmdShutdown) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for shutting down the MicroCloud daemon.
func (c *cmdShutdown) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down
2 changes: 2 additions & 0 deletions cmd/microcloud/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type cmdSQL struct {
common *CmdControl
}

// Command returns the subcommand for sql queries.
func (c *cmdSQL) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "sql <query>",
Expand All @@ -24,6 +25,7 @@ func (c *cmdSQL) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for sql queries.
func (c *cmdSQL) Run(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
err := cmd.Help()
Expand Down
2 changes: 2 additions & 0 deletions cmd/microcloud/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type cmdStatus struct {
common *CmdControl
}

// Command returns the subcommand for the deployment status.
func (c *cmdStatus) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "status",
Expand All @@ -101,6 +102,7 @@ func (c *cmdStatus) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for the deployment status.
func (c *cmdStatus) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down
6 changes: 6 additions & 0 deletions cmd/microcloud/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type cmdSecrets struct {
common *CmdControl
}

// Command returns the tokens subcommand.
func (c *cmdSecrets) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "tokens",
Expand All @@ -32,6 +33,7 @@ func (c *cmdSecrets) Command() *cobra.Command {
return cmd
}

// Run runs the tokens subcommand.
func (c *cmdSecrets) Run(cmd *cobra.Command, args []string) error {
return cmd.Help()
}
Expand All @@ -41,6 +43,7 @@ type cmdTokensList struct {
flagFormat string
}

// Command returns the subcommand for listing tokens.
func (c *cmdTokensList) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Expand All @@ -53,6 +56,7 @@ func (c *cmdTokensList) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for listing tokens.
func (c *cmdTokensList) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down Expand Up @@ -96,6 +100,7 @@ type cmdTokensRevoke struct {
common *CmdControl
}

// Command returns the subcommand for revoking tokens by name.
func (c *cmdTokensRevoke) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "revoke <name>",
Expand All @@ -106,6 +111,7 @@ func (c *cmdTokensRevoke) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for revoking tokens by name.
func (c *cmdTokensRevoke) Run(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return cmd.Help()
Expand Down
2 changes: 2 additions & 0 deletions cmd/microcloud/waitready.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type cmdWaitready struct {
flagTimeout int
}

// Command returns the subcommand for waiting on the daemon to be ready.
func (c *cmdWaitready) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "waitready",
Expand All @@ -26,6 +27,7 @@ func (c *cmdWaitready) Command() *cobra.Command {
return cmd
}

// Run runs the subcommand for waiting on the daemon to be ready.
func (c *cmdWaitready) Run(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
return cmd.Help()
Expand Down
2 changes: 2 additions & 0 deletions cmd/microcloudd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type cmdDaemon struct {
flagHeartbeatInterval time.Duration
}

// Command returns the main microcloudd command.
func (c *cmdDaemon) Command() *cobra.Command {
cmd := &cobra.Command{
Use: "microcloudd",
Expand All @@ -63,6 +64,7 @@ func (c *cmdDaemon) Command() *cobra.Command {
return cmd
}

// Run runs the main microcloudd command.
func (c *cmdDaemon) Run(cmd *cobra.Command, args []string) error {
if len(args) != 0 {
return cmd.Help()
Expand Down
2 changes: 1 addition & 1 deletion cmd/tui/selectable_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
// RemoveMsg is a table notification that returns a row index of the table to remove.
type RemoveMsg int

// TODO: Use DisableMsg to inform the initiator when a joiner's websocket has closed.
// DisableMsg is a table notification that returns a row index of the table to disable.
// TODO: Use DisableMsg to inform the initiator when a joiner's websocket has closed.
type DisableMsg int

// EnableMsg is a table notification that returns a row index of the table to enable, if it was disabled.
Expand Down
Loading