-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from WLaoDuo/master
v5.2
- Loading branch information
Showing
6 changed files
with
125 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
|
||
dist/ | ||
go.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,59 @@ | ||
package webdemo | ||
package appVersion | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
goversion "github.com/caarlos0/go-version" | ||
) | ||
|
||
var ( | ||
BuiltBy string | ||
Tag string | ||
Commit string | ||
Date string | ||
BuiltBy string | ||
Tag string | ||
Commit string | ||
Date string | ||
TreeState string | ||
) | ||
|
||
type Info struct { | ||
AppName string | ||
AppVersion string | ||
BuildTime string | ||
GitHash string | ||
// Pid int | ||
Platform string | ||
GoVersion string | ||
} | ||
// type infomation struct { | ||
// AppName string | ||
// AppVersion string | ||
// BuildTime string | ||
// GitHash string | ||
// // Pid int | ||
// Platform string | ||
// GoVersion string | ||
// } | ||
|
||
var ( | ||
AppInfo = Info{ | ||
AppName: "简易文件服务器", | ||
AppVersion: Tag, | ||
BuildTime: Date, | ||
GitHash: Commit, | ||
// Pid: os.Getpid(), | ||
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), | ||
GoVersion: runtime.Version(), | ||
} | ||
) | ||
// var ( | ||
// AppInfo = infomation{ | ||
// AppName: "简易文件服务器", | ||
// AppVersion: Tag, | ||
// BuildTime: Date, | ||
// GitHash: Commit, | ||
// // Pid: os.Getpid(), | ||
// Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), | ||
// GoVersion: runtime.Version(), | ||
// } | ||
// ) | ||
|
||
func BuildVersion() goversion.Info { | ||
return goversion.GetVersionInfo( | ||
goversion.WithAppDetails("简易文件http服务器", "局域网发送本地文件", "-h查询帮助"), | ||
// goversion.WithASCIIName(asciiArt), | ||
func(i *goversion.Info) { | ||
if Commit != "" { | ||
i.GitCommit = Commit | ||
} | ||
if TreeState != "" { | ||
i.GitTreeState = TreeState | ||
} | ||
if Date != "" { | ||
i.BuildDate = Date | ||
} | ||
if Tag != "" { | ||
i.GitVersion = Tag | ||
} | ||
if BuiltBy != "" { | ||
i.BuiltBy = BuiltBy | ||
} | ||
}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters