run go vet
This commit is contained in:
parent
55a3ed7187
commit
6e111ba862
Notes:
Jeff Carr
2025-02-14 19:21:02 -06:00
// `autogen:go.mod` module go.wit.com/apps/virtigo go 1.22 toolchain go1.23.6 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.26 go.wit.com/lib/protobuf/virtbuf v0.2.20 go.wit.com/lib/virtigolib v0.1.10 go.wit.com/log v0.22.16 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.26 h1:F+7aadEujsTgyBEs5ptKGL6N72reDkGd/7b0Ju4HeTU= go.wit.com/lib/gui/shell v0.22.26/go.mod h1:Km5o+DLU5up5jvTEum9wiTdsZZG/EUNERVzn2wJ6DBE= go.wit.com/lib/protobuf/virtbuf v0.2.20 h1:SqBp6lR9mFQF52sWBObz2g8l4o57ZYWyZ6BjXhx0uV0= go.wit.com/lib/protobuf/virtbuf v0.2.20/go.mod h1:3H0gOh05q7DQ6ziX/nW0zpkljxE8ZQpAHBPh0Tw4Z78= go.wit.com/lib/virtigolib v0.1.10 h1:Vw4y8Vh9JqOyofxiS0tXRTfAgVQ3BRZBjNzAs/iLHXI= go.wit.com/lib/virtigolib v0.1.10/go.mod h1:PdFIaewmiJKZpClMcgNfq/851AZhla+DwIdZWsvUqPU= go.wit.com/log v0.22.16 h1:E0Vd0Z2ILtfjhs7J/CQ4g13DK1jtQiYl6l5KOBGsZoA= go.wit.com/log v0.22.16/go.mod h1:/c5Uj30sWRQ4B5ei2ElB6Q8Si/cK6v+KbxnH208KD84= 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:`
32
Makefile
32
Makefile
|
@ -6,34 +6,11 @@ BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
# create the go.mod and go.sum if this is a brand new repo
|
# 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)
|
REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE= go mod init; GO111MODULE= go mod tidy; fi)
|
||||||
|
|
||||||
check_files:
|
all: build
|
||||||
@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
|
|
||||||
./virtigo --version
|
./virtigo --version
|
||||||
@echo build worked
|
@echo build worked
|
||||||
|
|
||||||
build:
|
build: goimports vet
|
||||||
GO111MODULE=off go build \
|
GO111MODULE=off go build \
|
||||||
-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}"
|
||||||
|
|
||||||
|
@ -96,6 +73,10 @@ release-build:
|
||||||
goimports:
|
goimports:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
|
|
||||||
|
vet:
|
||||||
|
@GO111MODULE=off go vet
|
||||||
|
@echo this go binary package builds okay
|
||||||
|
|
||||||
# remake the go.mod and go.sum files
|
# remake the go.mod and go.sum files
|
||||||
redomod:
|
redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
|
@ -105,6 +86,7 @@ redomod:
|
||||||
clean:
|
clean:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
rm -f virtigo*
|
rm -f virtigo*
|
||||||
|
go-mod-clean --purge
|
||||||
|
|
||||||
# git clone the sources and all the golang dependancies into ~/go/src
|
# 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/
|
# if you don't have go-clone, you can get it from http://go.wit.com/
|
||||||
|
|
|
@ -73,7 +73,7 @@ func importDomain(w http.ResponseWriter, r *http.Request) (string, error) {
|
||||||
// exports and builds a libvirt.Domain from the hypervisor
|
// exports and builds a libvirt.Domain from the hypervisor
|
||||||
domcfg, err := ExportLibvirtDomain(h.pb, domainName)
|
domcfg, err := ExportLibvirtDomain(h.pb, domainName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result = fmt.Sprintf("ExportLibvirtDomain() failed", err)
|
result = fmt.Sprint("ExportLibvirtDomain() failed", err)
|
||||||
log.Warn(result)
|
log.Warn(result)
|
||||||
fmt.Fprintln(w, result)
|
fmt.Fprintln(w, result)
|
||||||
return "", err
|
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
|
// merges and updates the droplet protobuf based on the libvirt XML
|
||||||
events, err := virtigolib.MergelibvirtDomain(d, domcfg)
|
events, err := virtigolib.MergelibvirtDomain(d, domcfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result = fmt.Sprintf("MerglibvirtDomain() failed for", d.Hostname, err)
|
result = fmt.Sprint("MerglibvirtDomain() failed for", d.Hostname, err)
|
||||||
log.Warn(result)
|
log.Warn(result)
|
||||||
fmt.Fprintln(w, result)
|
fmt.Fprintln(w, result)
|
||||||
return "", errors.New(result)
|
return "", errors.New(result)
|
||||||
|
|
2
poll.go
2
poll.go
|
@ -214,7 +214,7 @@ func uptimeCheck() (bool, string) {
|
||||||
summary += fmt.Sprintf("missing = %d ", len(missing))
|
summary += fmt.Sprintf("missing = %d ", len(missing))
|
||||||
}
|
}
|
||||||
if unknown > 0 {
|
if unknown > 0 {
|
||||||
summary += fmt.Sprintf("unknown = %d ", unknown, unknownList)
|
summary += fmt.Sprintf("unknown = %d %+v", unknown, unknownList)
|
||||||
}
|
}
|
||||||
if failed > 0 {
|
if failed > 0 {
|
||||||
summary += fmt.Sprintf("failed = %d ", failed)
|
summary += fmt.Sprintf("failed = %d ", failed)
|
||||||
|
|
|
@ -195,7 +195,6 @@ func getNewMac() string {
|
||||||
log.Info("using new MAC:", mac)
|
log.Info("using new MAC:", mac)
|
||||||
return mac
|
return mac
|
||||||
}
|
}
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// consistancy check. run on a regular basis
|
// consistancy check. run on a regular basis
|
||||||
|
@ -405,6 +404,4 @@ func setUniqueSpicePort(check *pb.Droplet) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// for loop never gets here
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue