fix version number handling
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
4bae43cf1b
commit
cdfdcd24a2
17
config.go
17
config.go
|
@ -238,7 +238,10 @@ func parseConfig() {
|
||||||
|
|
||||||
_, currentRef, _ := shell.Run("git rev-list -1 HEAD")
|
_, currentRef, _ := shell.Run("git rev-list -1 HEAD")
|
||||||
log.Println("CURRENT VERSION git ref =", currentRef)
|
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
|
config.Dirty = false
|
||||||
if (ref != currentRef) {
|
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{}) {
|
func perl(a ...interface{}) {
|
||||||
log.Println("reflect.TypeOf(a) =", reflect.TypeOf(a))
|
log.Println("reflect.TypeOf(a) =", reflect.TypeOf(a))
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,10 @@ func debugClick(b *gui.GuiButton) {
|
||||||
makeButton(Xbox1, nil, nil, "Debug IPv6", "SUBDOMAIN", func (*gui.GuiButton) {
|
makeButton(Xbox1, nil, nil, "Debug IPv6", "SUBDOMAIN", func (*gui.GuiButton) {
|
||||||
log.Println("Need to add IPv6 debugging here")
|
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")
|
Ybox2 := gui.NewBox(hardXbox, gui.Yaxis, "subdomain Y test")
|
||||||
makeButton(Ybox2, nil, nil, "Hide all tabs", "SUBDOMAIN", func (*gui.GuiButton) {
|
makeButton(Ybox2, nil, nil, "Hide all tabs", "SUBDOMAIN", func (*gui.GuiButton) {
|
||||||
|
@ -107,6 +111,7 @@ func runTestExecClick(b *gui.GuiButton) {
|
||||||
|
|
||||||
func runSimpleCommand(s string) {
|
func runSimpleCommand(s string) {
|
||||||
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
|
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)
|
cmdArgs := strings.Fields(cmd)
|
||||||
runCommand(cmdArgs)
|
runCommand(cmdArgs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@ func showSplashBox(gw *gui.GuiWindow) *gui.GuiBox {
|
||||||
gui.NewLabel(box,"OS: " + runtime.GOOS)
|
gui.NewLabel(box,"OS: " + runtime.GOOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.NewLabel(box, "Version: " + VERSION)
|
gui.NewLabel(box, "Version: " + config.Version)
|
||||||
|
|
||||||
if (config.Debug) {
|
if (config.Debug) {
|
||||||
gui.NewLabel(box, "git rev-list: " + GITCOMMIT)
|
gui.NewLabel(box, "git rev-list: " + config.Gitref)
|
||||||
gui.NewLabel(box, "go build version: " + GOVERSION)
|
gui.NewLabel(box, "go build version: " + config.Goversion)
|
||||||
gui.NewLabel(box, "build date: " + BUILDTIME)
|
gui.NewLabel(box, "build date: " + BUILDTIME)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
main.go
9
main.go
|
@ -98,6 +98,12 @@ func main() {
|
||||||
// golang application IMHO
|
// golang application IMHO
|
||||||
parseConfig()
|
parseConfig()
|
||||||
|
|
||||||
|
if (config.Dirty) {
|
||||||
|
config.Version = VERSION + " (dirty)"
|
||||||
|
} else {
|
||||||
|
config.Version = VERSION
|
||||||
|
}
|
||||||
|
|
||||||
for key, foo := range config.Accounts {
|
for key, foo := range config.Accounts {
|
||||||
log.Println("FOUND ACCOUNT = ", key, foo)
|
log.Println("FOUND ACCOUNT = ", key, foo)
|
||||||
}
|
}
|
||||||
|
@ -107,7 +113,8 @@ func main() {
|
||||||
|
|
||||||
v185AAAA := lookupAAAA("v000185.testing.com.customers.wprod.wit.com")
|
v185AAAA := lookupAAAA("v000185.testing.com.customers.wprod.wit.com")
|
||||||
log.Println("v185AAA = ", v185AAAA)
|
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()
|
go gui.WatchGUI()
|
||||||
|
|
||||||
// use this to discover what the OS thinks it's hostname is
|
// use this to discover what the OS thinks it's hostname is
|
||||||
|
|
Loading…
Reference in New Issue