Skip to content

Commit

Permalink
refactor: remove version package
Browse files Browse the repository at this point in the history
  • Loading branch information
henry40408 committed Aug 27, 2023
1 parent 66835b7 commit 2e6c6c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
16 changes: 10 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"sync/atomic"
"time"

"comics.app/version"
"golang.org/x/crypto/bcrypt"
"golang.org/x/term"

Expand All @@ -38,7 +37,12 @@ var (
port int
)

var completeVersion = fmt.Sprintf("%s (%s), built at %s", version.Version, version.Commit, version.BuildDate)
var (
Version = "dev"
Commit = "HEAD"
BuildDate = "undefined"
)
var versionString = fmt.Sprintf("%s (%s), built at %s", Version, Commit, BuildDate)

var (
ErrRescan = errors.New("Re-scan while scanning")
Expand Down Expand Up @@ -288,7 +292,7 @@ func RunServer() error {
"Elapsed": s.Elapsed.Milliseconds(),
"LastScanned": s.LastScanned.Format("2006-01-02T15:04:05-07:00"),
"Scanning": scanning.Load(),
"Version": completeVersion,
"Version": versionString,
})
return
}
Expand Down Expand Up @@ -338,7 +342,7 @@ func RunServer() error {
if ok {
ctx.HTML(http.StatusOK, "book.html", gin.H{
"Book": book,
"Version": completeVersion,
"Version": versionString,
})
return
}
Expand Down Expand Up @@ -389,15 +393,15 @@ var (
Use: "comics",
Short: "Simple file server for comic books",
Long: "Simple file server for comic books.",
Version: version.String(),
Version: versionString,
}
serveCmd = &cobra.Command{
Use: "serve",
Short: "Run the server",
Long: "Run the server.",
RunE: func(cmd *cobra.Command, args []string) error {
SetupLogger()
log.Printf("[INFO] comics %s", version.String())
log.Printf("[INFO] comics %s", versionString)
return RunServer()
},
}
Expand Down
13 changes: 0 additions & 13 deletions version/version.go

This file was deleted.

0 comments on commit 2e6c6c1

Please sign in to comment.