fixes for 'go vet'

This commit is contained in:
Jeff Carr 2025-03-05 13:33:04 -06:00
parent d214d670ac
commit 53dbe44d38
2 changed files with 33 additions and 25 deletions

View File

@ -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}"

45
http.go
View File

@ -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" {