clean out test code from config.go
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
77fef7e07f
commit
884b08e83e
68
config.go
68
config.go
|
@ -19,7 +19,6 @@ import "runtime"
|
||||||
// import "runtime/debug"
|
// import "runtime/debug"
|
||||||
import "io/ioutil"
|
import "io/ioutil"
|
||||||
import "strings"
|
import "strings"
|
||||||
import "reflect"
|
|
||||||
// import "bytes"
|
// import "bytes"
|
||||||
// import "sys"
|
// import "sys"
|
||||||
|
|
||||||
|
@ -178,11 +177,9 @@ func loadConfigFromFilename(filename string) pb.Config {
|
||||||
// will load the default config from within the go binary
|
// will load the default config from within the go binary
|
||||||
func loadDefaultConfig() *pb.Config {
|
func loadDefaultConfig() *pb.Config {
|
||||||
log.Println("TRY TO LOAD DEFAULT CONFIG")
|
log.Println("TRY TO LOAD DEFAULT CONFIG")
|
||||||
// defaultConfig, _ := packrBox.FindString("protobuf-config.json")
|
|
||||||
b, err := packrBox.FindString("cloud-control-panel.json")
|
b, err := packrBox.FindString("cloud-control-panel.json")
|
||||||
log.Println("b =", b)
|
log.Println("b =", b)
|
||||||
log.Println("err =", err)
|
log.Println("err =", err)
|
||||||
// var newpb *pb.Config
|
|
||||||
sets := pb.Config{}
|
sets := pb.Config{}
|
||||||
|
|
||||||
err = jsonpb.Unmarshal(strings.NewReader(string(b)), &sets)
|
err = jsonpb.Unmarshal(strings.NewReader(string(b)), &sets)
|
||||||
|
@ -200,18 +197,17 @@ func parseConfig() {
|
||||||
// first load the config file
|
// first load the config file
|
||||||
loadConfigFile()
|
loadConfigFile()
|
||||||
|
|
||||||
// override the config file from the command line
|
|
||||||
parseFlags()
|
|
||||||
|
|
||||||
log.Println("config.width", config.Width)
|
log.Println("config.width", config.Width)
|
||||||
log.Println("config.height", config.Height)
|
log.Println("config.height", config.Height)
|
||||||
log.Println("config.debug", config.Debug)
|
log.Println("config.debug", config.Debug)
|
||||||
|
|
||||||
// check that the config parsing worked
|
// override the config file from the command line
|
||||||
for key, foo := range config.Accounts {
|
parseFlags()
|
||||||
log.Println("account = ", key, foo)
|
|
||||||
log.Println("Accounts[key] = ", config.Accounts[key])
|
//
|
||||||
}
|
// This check should be here for now. The config file has all the keys
|
||||||
|
// if the user accidentally deletes it, it's like using your .ssh/ dir
|
||||||
|
//
|
||||||
if (config.Accounts == nil) {
|
if (config.Accounts == nil) {
|
||||||
log.Println("loadConfigFile() config.Accounts == nil")
|
log.Println("loadConfigFile() config.Accounts == nil")
|
||||||
log.Println("If debugging is on, should load default config here")
|
log.Println("If debugging is on, should load default config here")
|
||||||
|
@ -220,55 +216,9 @@ func parseConfig() {
|
||||||
tmp := loadDefaultConfig()
|
tmp := loadDefaultConfig()
|
||||||
config.Accounts = tmp.Accounts
|
config.Accounts = tmp.Accounts
|
||||||
log.Println("loadConfigFile() config.Accounts =", config.Accounts)
|
log.Println("loadConfigFile() config.Accounts =", config.Accounts)
|
||||||
|
config.Width = tmp.Width
|
||||||
|
config.Height = tmp.Height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// config.Gitref = shell.Run("git rev-list -1 HEAD")
|
|
||||||
|
|
||||||
config.Dirty = false
|
config.Dirty = false
|
||||||
/*
|
|
||||||
if (tagref == config.Gitref) {
|
|
||||||
log.Println("setting config.Dirty = false")
|
|
||||||
config.Dirty = false
|
|
||||||
} else {
|
|
||||||
log.Println("setting config.Dirty = true")
|
|
||||||
config.Dirty = true
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
log.Println("config.Gitref =", config.Gitref)
|
|
||||||
log.Println("config.Goversion =", config.Goversion)
|
|
||||||
log.Println("config.Dirty =", config.Dirty)
|
|
||||||
|
|
||||||
log.Println("runtime.Version =", runtime.Version())
|
|
||||||
log.Println("runtime Number of CPUs =", runtime.NumCPU())
|
|
||||||
log.Println("runtime Number of GoRoutines =", runtime.NumGoroutine())
|
|
||||||
|
|
||||||
log.Println("runtime.GOARCH =", runtime.GOARCH)
|
|
||||||
|
|
||||||
stackSlice := make([]byte, 12512) // made this number up for no reason
|
|
||||||
s := runtime.Stack(stackSlice, false)
|
|
||||||
fmt.Printf("\n%s", stackSlice[0:s])
|
|
||||||
// blah := runtime.Stack()
|
|
||||||
spew.Dump(s)
|
|
||||||
|
|
||||||
// bi, biok := debug.ReadBuildInfo()
|
|
||||||
// log.Println("debug.BuildInfo() ok =", biok)
|
|
||||||
// spew.Dump(bi.Path)
|
|
||||||
// spew.Dump(bi.Main)
|
|
||||||
// log.Println("debug.BuildInfo.Path =", bi.Path)
|
|
||||||
|
|
||||||
errChan <- "hello"
|
|
||||||
errChan <- fmt.Errorf("blah")
|
|
||||||
|
|
||||||
handleSignal(nil, 0)
|
|
||||||
// my pid (cross platform) p, err := os.FindProcess(os.Getpid())
|
|
||||||
// send signal (cross platform) return p.Signal(syscall.SIGTERM)
|
|
||||||
|
|
||||||
// for {}
|
|
||||||
// os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func perl(a ...interface{}) {
|
|
||||||
log.Println("reflect.TypeOf(a) =", reflect.TypeOf(a))
|
|
||||||
}
|
}
|
||||||
|
|
51
gui-debug.go
51
gui-debug.go
|
@ -138,3 +138,54 @@ func runCommand(cmdArgs []string) {
|
||||||
log.Println("runCommand() OTHERWISE INFORM THE USER")
|
log.Println("runCommand() OTHERWISE INFORM THE USER")
|
||||||
log.Println("runCommand() END")
|
log.Println("runCommand() END")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// just print config parsing worked
|
||||||
|
for key, foo := range config.Accounts {
|
||||||
|
log.Println("account = ", key, foo)
|
||||||
|
log.Println("Accounts[key] = ", config.Accounts[key])
|
||||||
|
}
|
||||||
|
// config.Gitref = shell.Run("git rev-list -1 HEAD")
|
||||||
|
|
||||||
|
config.Dirty = false
|
||||||
|
|
||||||
|
if (tagref == config.Gitref) {
|
||||||
|
log.Println("setting config.Dirty = false")
|
||||||
|
config.Dirty = false
|
||||||
|
} else {
|
||||||
|
log.Println("setting config.Dirty = true")
|
||||||
|
config.Dirty = true
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("config.Gitref =", config.Gitref)
|
||||||
|
log.Println("config.Goversion =", config.Goversion)
|
||||||
|
log.Println("config.Dirty =", config.Dirty)
|
||||||
|
|
||||||
|
log.Println("runtime.Version =", runtime.Version())
|
||||||
|
log.Println("runtime Number of CPUs =", runtime.NumCPU())
|
||||||
|
log.Println("runtime Number of GoRoutines =", runtime.NumGoroutine())
|
||||||
|
|
||||||
|
log.Println("runtime.GOARCH =", runtime.GOARCH)
|
||||||
|
|
||||||
|
stackSlice := make([]byte, 12512) // made this number up for no reason
|
||||||
|
s := runtime.Stack(stackSlice, false)
|
||||||
|
fmt.Printf("\n%s", stackSlice[0:s])
|
||||||
|
// blah := runtime.Stack()
|
||||||
|
spew.Dump(s)
|
||||||
|
|
||||||
|
// bi, biok := debug.ReadBuildInfo()
|
||||||
|
// log.Println("debug.BuildInfo() ok =", biok)
|
||||||
|
// spew.Dump(bi.Path)
|
||||||
|
// spew.Dump(bi.Main)
|
||||||
|
// log.Println("debug.BuildInfo.Path =", bi.Path)
|
||||||
|
|
||||||
|
errChan <- "hello"
|
||||||
|
errChan <- fmt.Errorf("blah")
|
||||||
|
|
||||||
|
handleSignal(nil, 0)
|
||||||
|
// my pid (cross platform) p, err := os.FindProcess(os.Getpid())
|
||||||
|
// send signal (cross platform) return p.Signal(syscall.SIGTERM)
|
||||||
|
|
||||||
|
// for {}
|
||||||
|
// os.Exit(0)
|
||||||
|
*/
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
77fef7e07f2127a87c77b9079ea392efc4c0ee0e
|
Loading…
Reference in New Issue