Skip to content

Commit 24026ca

Browse files
author
Timothy Yen
committed
Add main that reads build info and prints main version
1 parent 9ff9138 commit 24026ca

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/kollektiv/examplegotool
2+
3+
go 1.14

main.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package main
2+
3+
import (
4+
"log"
5+
"runtime/debug"
6+
)
7+
8+
func main() {
9+
info, ok := debug.ReadBuildInfo()
10+
if !ok {
11+
log.Fatalln("could not reading build info")
12+
}
13+
14+
log.Println("main module version:", info.Main.Version)
15+
}

0 commit comments

Comments
 (0)