run go vet

This commit is contained in:
Jeff Carr 2025-02-08 20:05:15 -06:00
parent 55a3ed7187
commit 6e111ba862
Notes: Jeff Carr 2025-02-08 21:23:35 -06:00
// `autogen:go.mod`

module go.wit.com/apps/virtigo

go 1.22

toolchain go1.23.4

require (
	github.com/google/uuid v1.6.0
	go.wit.com/dev/alexflint/arg v1.5.5
	go.wit.com/lib/gui/shell v0.22.24
	go.wit.com/lib/protobuf/virtbuf v0.2.19
	go.wit.com/lib/virtigolib v0.1.9
	go.wit.com/log v0.22.11
	google.golang.org/protobuf v1.36.5
	libvirt.org/go/libvirtxml v1.11000.1
)

require (
	github.com/go-cmd/cmd v1.4.3 // indirect
	go.wit.com/dev/alexflint/scalar v1.2.4 // indirect
)

// `autogen:go.sum`

github.com/go-cmd/cmd v1.4.3 h1:6y3G+3UqPerXvPcXvj+5QNPHT02BUw7p6PsqRxLNA7Y=
github.com/go-cmd/cmd v1.4.3/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk=
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
go.wit.com/dev/alexflint/arg v1.5.5 h1:c4jgIb4OvHjnCMRNSjOa1sNLl6WDxV6tIkMVezR9hCk=
go.wit.com/dev/alexflint/arg v1.5.5/go.mod h1:nH3F6TJDaAUgnLkC0WgRN/H047YfN1TYKaWPYr6B8lo=
go.wit.com/dev/alexflint/scalar v1.2.4 h1:zmBeEkObwz1lcelwfGNYP2GS6SQ9e0tdv7JdHwMZEEk=
go.wit.com/dev/alexflint/scalar v1.2.4/go.mod h1:kCNO1Fo5LnnK6+qa+zYhP5fdgfC1C+vx1ti99Md+FAM=
go.wit.com/lib/gui/shell v0.22.24 h1:zfwOAOuTggaeHboaoH+pi5jn7rdXGqHgrRtHVbdFNRA=
go.wit.com/lib/gui/shell v0.22.24/go.mod h1:/9FxkZ4KrpocGNOuig3+LyQHdjeobQ5NDBRo+WojZ6w=
go.wit.com/lib/protobuf/virtbuf v0.2.19 h1:osepRkztMLTY26luB61oD4A/MK13sx/tiSo/HLxt3OE=
go.wit.com/lib/protobuf/virtbuf v0.2.19/go.mod h1:bPq7oT3gyJ88/ER/CFnhOnOo2vmEg9nmgkw29lidSOk=
go.wit.com/lib/virtigolib v0.1.9 h1:ITKyURDbu2J5NN0pFwMP48tkrPHZO2PuOHUHIROi9O8=
go.wit.com/lib/virtigolib v0.1.9/go.mod h1:8dC83Deax6XooIKznZ6SEHanNhs25+FKbDEuTrugocg=
go.wit.com/log v0.22.11 h1:BiJe+S81kWrMqW1QyZVu1Es2d//WG9FAcZQEhZkkM4c=
go.wit.com/log v0.22.11/go.mod h1:LsP0nAH4hZEf2qj/F5UmGQT0OEJ3Q5698/P8ZOI2JuE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
libvirt.org/go/libvirtxml v1.11000.1 h1:xbqKCYJRr3QPamY0PKE/exAGgTCosH5s4vB6NPXGcFY=
libvirt.org/go/libvirtxml v1.11000.1/go.mod h1:7Oq2BLDstLr/XtoQD8Fr3mfDNrzlI3utYKySXF2xkng=

// `autogen:`
4 changed files with 10 additions and 31 deletions

View File

@ -6,34 +6,11 @@ BUILDTIME = $(shell date +%Y.%m.%d)
# create the go.mod and go.sum if this is a brand new repo
REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE= go mod init; GO111MODULE= go mod tidy; fi)
check_files:
@echo
@echo the build is complicated right now because you need
@echo the google version of protoc-gen-go which is not the one in debian sid yet
@echo
@if [ -f "/usr/bin/protoc-gen-go" ]; then \
echo "the protoc-gen-go package is old in debian sid right now"; \
echo "for now, remove it"; \
apt remote proto-gen-go \
exit 1; \
fi
@if [ ! -f "../../lib/protobuf/virtbuf/droplet.pb.go" ]; then \
echo "you must build the protobuf files first"; \
echo "They should be in: ../../lib/protobuf/virtbuf/droplet.pb.go"; \
make -C ../../lib/protobuf/virtbuf/; \
fi
@if [ ! -f "$(HOME)/go/bin/protoc-gen-go" ]; then \
echo "you must build protoc-gen-go from google"; \
exit 1; \
fi
make all
all:
make build
all: build
./virtigo --version
@echo build worked
build:
build: goimports vet
GO111MODULE=off go build \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
@ -96,6 +73,10 @@ release-build:
goimports:
goimports -w *.go
vet:
@GO111MODULE=off go vet
@echo this go binary package builds okay
# remake the go.mod and go.sum files
redomod:
rm -f go.*
@ -105,6 +86,7 @@ redomod:
clean:
rm -f go.*
rm -f virtigo*
go-mod-clean --purge
# git clone the sources and all the golang dependancies into ~/go/src
# if you don't have go-clone, you can get it from http://go.wit.com/

View File

@ -73,7 +73,7 @@ func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
// exports and builds a libvirt.Domain from the hypervisor
domcfg, err := ExportLibvirtDomain(h.pb, domainName)
if err != nil {
result = fmt.Sprintf("ExportLibvirtDomain() failed", err)
result = fmt.Sprint("ExportLibvirtDomain() failed", err)
log.Warn(result)
fmt.Fprintln(w, result)
return "", err
@ -82,7 +82,7 @@ func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
// merges and updates the droplet protobuf based on the libvirt XML
events, err := virtigolib.MergelibvirtDomain(d, domcfg)
if err != nil {
result = fmt.Sprintf("MerglibvirtDomain() failed for", d.Hostname, err)
result = fmt.Sprint("MerglibvirtDomain() failed for", d.Hostname, err)
log.Warn(result)
fmt.Fprintln(w, result)
return "", errors.New(result)

View File

@ -214,7 +214,7 @@ func uptimeCheck() (bool, string) {
summary += fmt.Sprintf("missing = %d ", len(missing))
}
if unknown > 0 {
summary += fmt.Sprintf("unknown = %d ", unknown, unknownList)
summary += fmt.Sprintf("unknown = %d %+v", unknown, unknownList)
}
if failed > 0 {
summary += fmt.Sprintf("failed = %d ", failed)

View File

@ -195,7 +195,6 @@ func getNewMac() string {
log.Info("using new MAC:", mac)
return mac
}
return ""
}
// consistancy check. run on a regular basis
@ -405,6 +404,4 @@ func setUniqueSpicePort(check *pb.Droplet) error {
return nil
}
// for loop never gets here
return nil
}