Skip to content

Commit

Permalink
Changed command to pointer reciever
Browse files Browse the repository at this point in the history
  • Loading branch information
baalimago committed Aug 18, 2024
1 parent 0511239 commit 8df68aa
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ type command struct {
getVersionCmd func() (*debug.BuildInfo, bool)
}

// Describe the version command
func (c command) Describe() string {
// Describe the version *command
func (c *command) Describe() string {
return "print the version of wd-40"
}

// Flagset for version, currently empty
func (c command) Flagset() *flag.FlagSet {
func (c *command) Flagset() *flag.FlagSet {
return flag.NewFlagSet("version", flag.ExitOnError)
}

// Help by printing out help
func (c command) Help() string {
func (c *command) Help() string {
return "Print the version of wd-40"
}

// Run the command, printing the version using either the debugbuild or tagged version
func (c command) Run(context.Context) error {
// Run the *command, printing the version using either the debugbuild or tagged version
func (c *command) Run(context.Context) error {
bi, ok := c.getVersionCmd()
if !ok {
return errors.New("failed to read build info")
Expand All @@ -51,8 +51,8 @@ func (c command) Run(context.Context) error {
return nil
}

// Setup the command
func (c command) Setup() error {
// Setup the *command
func (c *command) Setup() error {
c.getVersionCmd = debug.ReadBuildInfo
return nil
}
Expand Down

0 comments on commit 8df68aa

Please sign in to comment.