From a05e4d09829968bd930b8d0a4acefd5443fa9c7f Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 8 Nov 2022 19:13:31 -0500 Subject: [PATCH] Remove App.Compiled Closes #753 --- app.go | 18 ------------------ godoc-current.txt | 2 -- testdata/godoc-v3.x.txt | 2 -- 3 files changed, 22 deletions(-) diff --git a/app.go b/app.go index e7f79c5..221b6ad 100644 --- a/app.go +++ b/app.go @@ -9,7 +9,6 @@ import ( "path/filepath" "sort" "strings" - "time" ) const suggestDidYouMeanTemplate = "Did you mean %q?" @@ -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 @@ -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 { @@ -147,7 +134,6 @@ func NewApp() *App { UsageText: "", BashComplete: DefaultAppComplete, Action: helpCommand.Action, - Compiled: compileTime(), Reader: os.Stdin, Writer: os.Stdout, ErrWriter: os.Stderr, @@ -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 } diff --git a/godoc-current.txt b/godoc-current.txt index fbcd2ec..65ec07a 100644 --- a/godoc-current.txt +++ b/godoc-current.txt @@ -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 diff --git a/testdata/godoc-v3.x.txt b/testdata/godoc-v3.x.txt index fbcd2ec..65ec07a 100644 --- a/testdata/godoc-v3.x.txt +++ b/testdata/godoc-v3.x.txt @@ -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