fix version number handling

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-05 02:52:35 -07:00
parent 4bae43cf1b
commit cdfdcd24a2
4 changed files with 32 additions and 5 deletions

View File

@ -238,7 +238,10 @@ func parseConfig() {
_, currentRef, _ := shell.Run("git rev-list -1 HEAD")
log.Println("CURRENT VERSION git ref =", currentRef)
config.Gitref = currentRef
config.Gitref = strings.TrimSuffix(currentRef, "\n")
_, goversion, _ := shell.Run("go version")
config.Goversion = strings.TrimSuffix(goversion, "\n")
config.Dirty = false
if (ref != currentRef) {
@ -246,6 +249,18 @@ func parseConfig() {
}
}
// TODO: fix this to chomp \n \r NULL \t and ' '
func chomp(s string) string {
// var bytesBuffer bytes.Buffer
// var bytesSplice []byte
// byteSlice := bytesBuffer.Bytes()
// b := bytes.Trim(byteSlice, "\x00") // removes NULL
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
cmd = strings.TrimSuffix(cmd, "\n") // this is like 'chomp' in perl
return cmd
}
func perl(a ...interface{}) {
log.Println("reflect.TypeOf(a) =", reflect.TypeOf(a))
}

View File

@ -44,6 +44,10 @@ func debugClick(b *gui.GuiButton) {
makeButton(Xbox1, nil, nil, "Debug IPv6", "SUBDOMAIN", func (*gui.GuiButton) {
log.Println("Need to add IPv6 debugging here")
})
Ybox3 := gui.NewBox(Ybox1, gui.Yaxis, "subdomain Y1 test")
gui.NewLabel(Ybox3, "git rev-list: " + config.Gitref)
gui.NewLabel(Ybox3, "go build version: " + config.Goversion)
gui.NewLabel(Ybox3, "build date: " + BUILDTIME)
Ybox2 := gui.NewBox(hardXbox, gui.Yaxis, "subdomain Y test")
makeButton(Ybox2, nil, nil, "Hide all tabs", "SUBDOMAIN", func (*gui.GuiButton) {
@ -107,6 +111,7 @@ func runTestExecClick(b *gui.GuiButton) {
func runSimpleCommand(s string) {
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
cmd = strings.TrimSuffix(cmd, "\n") // this is like 'chomp' in perl
cmdArgs := strings.Fields(cmd)
runCommand(cmdArgs)
}

View File

@ -24,11 +24,11 @@ func showSplashBox(gw *gui.GuiWindow) *gui.GuiBox {
gui.NewLabel(box,"OS: " + runtime.GOOS)
}
gui.NewLabel(box, "Version: " + VERSION)
gui.NewLabel(box, "Version: " + config.Version)
if (config.Debug) {
gui.NewLabel(box, "git rev-list: " + GITCOMMIT)
gui.NewLabel(box, "go build version: " + GOVERSION)
gui.NewLabel(box, "git rev-list: " + config.Gitref)
gui.NewLabel(box, "go build version: " + config.Goversion)
gui.NewLabel(box, "build date: " + BUILDTIME)
}

View File

@ -98,6 +98,12 @@ func main() {
// golang application IMHO
parseConfig()
if (config.Dirty) {
config.Version = VERSION + " (dirty)"
} else {
config.Version = VERSION
}
for key, foo := range config.Accounts {
log.Println("FOUND ACCOUNT = ", key, foo)
}
@ -107,7 +113,8 @@ func main() {
v185AAAA := lookupAAAA("v000185.testing.com.customers.wprod.wit.com")
log.Println("v185AAA = ", v185AAAA)
go gorillaDial("ccp.wit.com:9000")
// go gorillaDial("ccp.wit.com:9000")
go gorillaDial("stackapi-ccp.stackapi.customers.wit.com:9000")
go gui.WatchGUI()
// use this to discover what the OS thinks it's hostname is