still does nothing yet
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f7ae394d20
commit
f71da2ef59
16
Makefile
16
Makefile
|
@ -1,7 +1,17 @@
|
|||
VERSION = $(shell git describe --tags)
|
||||
|
||||
# create the go.mod and go.sum if this is a brand new repo
|
||||
# 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:
|
||||
make redomod
|
||||
GO111MODULE= go build
|
||||
sudo ./virtigod
|
||||
GO111MODULE=off go build -v -x -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}"
|
||||
./virtigod --version
|
||||
|
||||
# this is for release builds using the go.mod files
|
||||
release-build:
|
||||
@echo ${REDOMOD}
|
||||
go build -v -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
# makes a .deb package
|
||||
debian:
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
/*
|
||||
this parses the command line arguements
|
||||
this enables command line options from other packages like 'gui' and 'log'
|
||||
*/
|
||||
|
||||
import (
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
)
|
||||
|
||||
var argv args
|
||||
|
||||
type args struct {
|
||||
ListRepos bool `arg:"--list-repos" help:"list all repositories"`
|
||||
Port int `arg:"--port" default:"2520" help:"port to run on"`
|
||||
}
|
||||
|
||||
func (args) Version() string {
|
||||
return "virtigod " + Version
|
||||
}
|
||||
|
||||
func init() {
|
||||
arg.MustParse(&argv)
|
||||
}
|
8
main.go
8
main.go
|
@ -25,11 +25,7 @@ import (
|
|||
"github.com/digitalocean/go-qemu/qemu"
|
||||
)
|
||||
|
||||
var (
|
||||
network = flag.String("network", "unix", `Named network used to connect on. For Unix sockets -network=unix, for TCP connections: -network=tcp`)
|
||||
address = flag.String("address", "/var/run/libvirt/libvirt-sock", `Address of the hypervisor. This could be in the form of Unix or TCP sockets. For TCP connections: -address="host:16509"`)
|
||||
timeout = flag.Duration("timeout", 2*time.Second, "Connection timeout. Another valid value could be -timeout=500ms")
|
||||
)
|
||||
var Version string
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
@ -37,7 +33,7 @@ func main() {
|
|||
// fmt.Printf("\nConnecting to %s://%s\n", *network, *address)
|
||||
newConn := func() (net.Conn, error) {
|
||||
// return net.DialTimeout(*network, *address, *timeout)
|
||||
return net.DialTimeout("unix", "/var/run/libvirt/libvirt-sock", *timeout)
|
||||
return net.DialTimeout("unix", "/var/run/libvirt/libvirt-sock", 2*time.Second)
|
||||
// return net.DialTimeout("tcp", "farm02:16514", *timeout)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue