summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile32
-rw-r--r--importDomain.go4
-rw-r--r--poll.go2
-rw-r--r--validate.go3
4 files changed, 10 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index a33cdb0..efad4a2 100644
--- a/Makefile
+++ b/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
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/
diff --git a/importDomain.go b/importDomain.go
index 71aa42b..c7f7f45 100644
--- a/importDomain.go
+++ b/importDomain.go
@@ -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)
diff --git a/poll.go b/poll.go
index 8c238ef..15f8aa4 100644
--- a/poll.go
+++ b/poll.go
@@ -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)
diff --git a/validate.go b/validate.go
index 8f0f948..284bde3 100644
--- a/validate.go
+++ b/validate.go
@@ -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
}