We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 16c9748 commit 5e19e2cCopy full SHA for 5e19e2c
main.go
@@ -6,15 +6,26 @@ import (
6
"net/http"
7
"os"
8
"path/filepath"
9
+ "runtime/debug"
10
)
11
12
var dir string
13
var port string
14
+var version bool
15
16
func init() {
17
flag.StringVar(&port, "p", "8100", "port to serve on")
18
flag.StringVar(&dir, "path", "./", "the directory of static file to host")
19
+ flag.BoolVar(&version, "version", false, "print program version")
20
flag.Parse()
21
+
22
+ if version {
23
+ info, ok := debug.ReadBuildInfo()
24
+ if ok {
25
+ println(info.Main.Version, info.Main.Sum)
26
+ }
27
+ os.Exit(0)
28
29
if dir == "./" {
30
dir, _ = os.Getwd()
31
}
0 commit comments