Merge pull request #1579 from urfave/drop-compiled

Remove App.Compiled
This commit is contained in:
Dan Buch 2022-11-09 20:39:19 -05:00 committed by GitHub
commit 689dfd65e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 22 deletions

18
app.go
View File

@ -9,7 +9,6 @@ import (
"path/filepath" "path/filepath"
"sort" "sort"
"strings" "strings"
"time"
) )
const suggestDidYouMeanTemplate = "Did you mean %q?" const suggestDidYouMeanTemplate = "Did you mean %q?"
@ -81,8 +80,6 @@ type App struct {
OnUsageError OnUsageErrorFunc OnUsageError OnUsageErrorFunc
// Execute this function when an invalid flag is accessed from the context // Execute this function when an invalid flag is accessed from the context
InvalidFlagAccessHandler InvalidFlagAccessFunc InvalidFlagAccessHandler InvalidFlagAccessFunc
// Compilation date
Compiled time.Time
// List of all authors who contributed // List of all authors who contributed
Authors []*Author Authors []*Author
// Copyright of the binary if any // Copyright of the binary if any
@ -128,16 +125,6 @@ type SuggestFlagFunc func(flags []Flag, provided string, hideHelp bool) string
type SuggestCommandFunc func(commands []*Command, provided string) 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, // NewApp creates a new cli Application with some reasonable defaults for Name,
// Usage, Version and Action. // Usage, Version and Action.
func NewApp() *App { func NewApp() *App {
@ -147,7 +134,6 @@ func NewApp() *App {
UsageText: "", UsageText: "",
BashComplete: DefaultAppComplete, BashComplete: DefaultAppComplete,
Action: helpCommand.Action, Action: helpCommand.Action,
Compiled: compileTime(),
Reader: os.Stdin, Reader: os.Stdin,
Writer: os.Stdout, Writer: os.Stdout,
ErrWriter: os.Stderr, ErrWriter: os.Stderr,
@ -188,10 +174,6 @@ func (a *App) Setup() {
a.Action = helpCommand.Action a.Action = helpCommand.Action
} }
if a.Compiled == (time.Time{}) {
a.Compiled = compileTime()
}
if a.Reader == nil { if a.Reader == nil {
a.Reader = os.Stdin a.Reader = os.Stdin
} }

View File

@ -292,8 +292,6 @@ type App struct {
OnUsageError OnUsageErrorFunc OnUsageError OnUsageErrorFunc
// Execute this function when an invalid flag is accessed from the context // Execute this function when an invalid flag is accessed from the context
InvalidFlagAccessHandler InvalidFlagAccessFunc InvalidFlagAccessHandler InvalidFlagAccessFunc
// Compilation date
Compiled time.Time
// List of all authors who contributed // List of all authors who contributed
Authors []*Author Authors []*Author
// Copyright of the binary if any // Copyright of the binary if any

View File

@ -292,8 +292,6 @@ type App struct {
OnUsageError OnUsageErrorFunc OnUsageError OnUsageErrorFunc
// Execute this function when an invalid flag is accessed from the context // Execute this function when an invalid flag is accessed from the context
InvalidFlagAccessHandler InvalidFlagAccessFunc InvalidFlagAccessHandler InvalidFlagAccessFunc
// Compilation date
Compiled time.Time
// List of all authors who contributed // List of all authors who contributed
Authors []*Author Authors []*Author
// Copyright of the binary if any // Copyright of the binary if any