Skip to content

Commit

Permalink
Merge pull request #1579 from urfave/drop-compiled
Browse files Browse the repository at this point in the history
Remove App.Compiled
  • Loading branch information
meatballhat authored Nov 10, 2022
2 parents 02bba4b + a05e4d0 commit 689dfd6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
18 changes: 0 additions & 18 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"path/filepath"
"sort"
"strings"
"time"
)

const suggestDidYouMeanTemplate = "Did you mean %q?"
Expand Down Expand Up @@ -81,8 +80,6 @@ type App struct {
OnUsageError OnUsageErrorFunc
// Execute this function when an invalid flag is accessed from the context
InvalidFlagAccessHandler InvalidFlagAccessFunc
// Compilation date
Compiled time.Time
// List of all authors who contributed
Authors []*Author
// Copyright of the binary if any
Expand Down Expand Up @@ -128,16 +125,6 @@ type SuggestFlagFunc func(flags []Flag, provided string, hideHelp bool) string

type SuggestCommandFunc func(commands []*Command, provided string) string

// Tries to find out when this binary was compiled.
// Returns the current time if it fails to find it.
func compileTime() time.Time {
info, err := os.Stat(os.Args[0])
if err != nil {
return time.Now()
}
return info.ModTime()
}

// NewApp creates a new cli Application with some reasonable defaults for Name,
// Usage, Version and Action.
func NewApp() *App {
Expand All @@ -147,7 +134,6 @@ func NewApp() *App {
UsageText: "",
BashComplete: DefaultAppComplete,
Action: helpCommand.Action,
Compiled: compileTime(),
Reader: os.Stdin,
Writer: os.Stdout,
ErrWriter: os.Stderr,
Expand Down Expand Up @@ -188,10 +174,6 @@ func (a *App) Setup() {
a.Action = helpCommand.Action
}

if a.Compiled == (time.Time{}) {
a.Compiled = compileTime()
}

if a.Reader == nil {
a.Reader = os.Stdin
}
Expand Down
2 changes: 0 additions & 2 deletions godoc-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ type App struct {
OnUsageError OnUsageErrorFunc
// Execute this function when an invalid flag is accessed from the context
InvalidFlagAccessHandler InvalidFlagAccessFunc
// Compilation date
Compiled time.Time
// List of all authors who contributed
Authors []*Author
// Copyright of the binary if any
Expand Down
2 changes: 0 additions & 2 deletions testdata/godoc-v3.x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ type App struct {
OnUsageError OnUsageErrorFunc
// Execute this function when an invalid flag is accessed from the context
InvalidFlagAccessHandler InvalidFlagAccessFunc
// Compilation date
Compiled time.Time
// List of all authors who contributed
Authors []*Author
// Copyright of the binary if any
Expand Down

0 comments on commit 689dfd6

Please sign in to comment.