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.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) REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE= go mod init; GO111MODULE= go mod tidy; fi)
all: goimports build all: goimports gocui
./zookeeper # ./zookeeper
vet:
@GO111MODULE=off go vet
@echo this go binary package builds okay
nogui: nogui:
./zookeeper --gui nocui ./zookeeper --gui nocui
build: gocui: build
./zookeeper --gui gocui >/tmp/forge.log 2>&1
build: goimports vet
GO111MODULE=off go build -v -x \ GO111MODULE=off go build -v -x \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -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" "net/http"
"strings" "strings"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/zoopb" "go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log" "go.wit.com/log"
) )
@ -43,28 +42,30 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
handleMachine(r, w, hostname, msg) handleMachine(r, w, hostname, msg)
return return
var m *zoopb.Machine /*
m = new(zoopb.Machine) var m *zoopb.Machine
if err := m.Unmarshal(msg); err != nil { m = new(zoopb.Machine)
log.Info("zoo host sent unknown machine protobuf len", len(msg)) if err := m.Unmarshal(msg); err != nil {
forgepb.IdentifyProtobuf(msg) log.Info("zoo host sent unknown machine protobuf len", len(msg))
log.Info("error =", err) forgepb.IdentifyProtobuf(msg)
return 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")
} }
default: log.Log(INFO, "proto.Unmarshal() worked on wire message len", len(msg), "from", m.Hostname)
fmt.Fprintln(w, "notsure") b := me.upgrade[m.Hostname]
} switch updateMachine(m) {
return 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" { if route == "/status" {