diff --git a/Makefile b/Makefile index 3780da9..d753ca0 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,20 @@ BUILDTIME = $(shell date +%Y.%m.%d_%H%M) # REDOMOD = $(shell if [ -e go.mod ]; then echo go.mod; else echo no go mod; fi) REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE= go mod init; GO111MODULE= go mod tidy; fi) -all: goimports build - ./zookeeper +all: goimports gocui + # ./zookeeper + +vet: + @GO111MODULE=off go vet + @echo this go binary package builds okay nogui: ./zookeeper --gui nocui -build: +gocui: build + ./zookeeper --gui gocui >/tmp/forge.log 2>&1 + +build: goimports vet GO111MODULE=off go build -v -x \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" diff --git a/http.go b/http.go index 92adb37..2b70d8e 100644 --- a/http.go +++ b/http.go @@ -9,7 +9,6 @@ import ( "net/http" "strings" - "go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/zoopb" "go.wit.com/log" ) @@ -43,28 +42,30 @@ func okHandler(w http.ResponseWriter, r *http.Request) { handleMachine(r, w, hostname, msg) return - var m *zoopb.Machine - m = new(zoopb.Machine) - if err := m.Unmarshal(msg); err != nil { - log.Info("zoo host sent unknown machine protobuf len", len(msg)) - forgepb.IdentifyProtobuf(msg) - log.Info("error =", err) - return - } - log.Log(INFO, "proto.Unmarshal() worked on wire message len", len(msg), "from", m.Hostname) - b := me.upgrade[m.Hostname] - switch updateMachine(m) { - case "upgrade": - if b { - fmt.Fprintln(w, "apt update") - me.upgrade[m.Hostname] = false - } else { - fmt.Fprintln(w, "upgrade") + /* + var m *zoopb.Machine + m = new(zoopb.Machine) + if err := m.Unmarshal(msg); err != nil { + log.Info("zoo host sent unknown machine protobuf len", len(msg)) + forgepb.IdentifyProtobuf(msg) + log.Info("error =", err) + return } - default: - fmt.Fprintln(w, "notsure") - } - return + log.Log(INFO, "proto.Unmarshal() worked on wire message len", len(msg), "from", m.Hostname) + b := me.upgrade[m.Hostname] + switch updateMachine(m) { + case "upgrade": + if b { + fmt.Fprintln(w, "apt update") + me.upgrade[m.Hostname] = false + } else { + fmt.Fprintln(w, "upgrade") + } + default: + fmt.Fprintln(w, "notsure") + } + return + */ } if route == "/status" {