Skip to content

Commit

Permalink
Create EnableVersionCheck flag
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Dec 17, 2024
1 parent 36edfc8 commit 89e7b35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
8 changes: 6 additions & 2 deletions cmd/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func run() error {
dir := flags.Dir
entrypoint := flags.Entrypoint

// Initialise version
ver.Init()

if flags.Version {
fmt.Printf("Task version: %s\n", ver.GetVersionWithSum())
return nil
Expand Down Expand Up @@ -132,8 +135,9 @@ func run() error {
Stdout: os.Stdout,
Stderr: os.Stderr,

OutputStyle: flags.Output,
TaskSorter: taskSorter,
OutputStyle: flags.Output,
TaskSorter: taskSorter,
EnableVersionCheck: true,
}
listOptions := task.NewListOptions(flags.List, flags.ListAll, flags.ListJson, flags.NoStatus)
if err := listOptions.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var (
sum = ""
)

func init() {
func Init() {
info, ok := debug.ReadBuildInfo()
if !ok || info.Main.Version == "" {
version = "unknown"
Expand Down
2 changes: 1 addition & 1 deletion setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (e *Executor) setupConcurrencyState() {
}

func (e *Executor) doVersionChecks() error {
if e.DisableVersionCheck {
if !e.EnableVersionCheck {
return nil
}
// Copy the version to avoid modifying the original
Expand Down
14 changes: 7 additions & 7 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ type Executor struct {
Stdout io.Writer
Stderr io.Writer

Logger *logger.Logger
Compiler *compiler.Compiler
Output output.Output
OutputStyle ast.Output
TaskSorter sort.TaskSorter
UserWorkingDir string
DisableVersionCheck bool
Logger *logger.Logger
Compiler *compiler.Compiler
Output output.Output
OutputStyle ast.Output
TaskSorter sort.TaskSorter
UserWorkingDir string
EnableVersionCheck bool

fuzzyModel *fuzzy.Model

Expand Down

0 comments on commit 89e7b35

Please sign in to comment.