Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tonidy committed Jan 29, 2025
1 parent 5f718cd commit f8a08d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/specialcmd/specialcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func execSpecialConfig(msg kernel.Message, goExec *goexec.State, cmdStr string,
klog.Errorf("Failed publishing help contents: %+v", err)
}
case "version":
err := kernel.PublishMarkdown(msg, version.AppVersion.PrintMarkdown())
err := kernel.PublishMarkdown(msg, version.AppVersion.Markdown())
if err != nil {
klog.Errorf("Failed publishing version contents: %+v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (v *VersionInfo) Print() {
fmt.Printf(" Go version: %s (OS: %s, arch: %s)\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
}

func (v *VersionInfo) PrintMarkdown() string {
func (v *VersionInfo) Markdown() string {
var markdown string
markdown += fmt.Sprintf("## GoNB version: `%s`\n\n", v.Version)

Expand Down
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ func main() {

flag.Parse()

printVersion()
if printVersion() {
return
}

// Setup logging.
if *flagExtraLog != "" {
Expand Down Expand Up @@ -156,14 +158,15 @@ func main() {
klog.Infof("Exiting...")
}

func printVersion() {
func printVersion() bool {
if *flagShortVersion {
fmt.Println(version.AppVersion.String())
os.Exit(0)
return true
} else if *flagLongVersion {
version.AppVersion.Print()
os.Exit(0)
return true
}
return false
}

var (
Expand Down

0 comments on commit f8a08d2

Please sign in to comment.