Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
applied minimum supported version for buffalo info
Browse files Browse the repository at this point in the history
  • Loading branch information
sio4 committed Jul 13, 2022
1 parent d69adcd commit 5786711
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/cmd/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package info
import (
"context"
"os/exec"
"runtime"
"strings"
"time"

"github.com/gobuffalo/clara/v2/genny/rx"
Expand All @@ -26,6 +28,7 @@ func runE(cmd *cobra.Command, args []string) error {
} else {
// no clara binary, so use the one bundled with buffalo
copts := infoOptions.Clara
rx.GoMinimums = []string{">=" + minGoVersion(false)}
if err := run.WithNew(rx.New(copts)); err != nil {
return err
}
Expand All @@ -38,3 +41,12 @@ func runE(cmd *cobra.Command, args []string) error {

return run.Run()
}

func minGoVersion(useBuilderVersion bool) string {
// TODO: can we make this rule?
if useBuilderVersion {
version := strings.TrimPrefix(runtime.Version(), "go")
return strings.Join(strings.Split(version, ".")[0:2], ".")
}
return "1.17"
}

0 comments on commit 5786711

Please sign in to comment.