From 8df68aaa2aec0ce4ee22d5752cb87c86c4b12614 Mon Sep 17 00:00:00 2001 From: imago Date: Sun, 18 Aug 2024 13:13:39 +0300 Subject: [PATCH] Changed command to pointer reciever --- cmd/version/version.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/version/version.go b/cmd/version/version.go index 017f2c9..fa8dcf8 100644 --- a/cmd/version/version.go +++ b/cmd/version/version.go @@ -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") @@ -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 }