never put binaries in go libraries
This commit is contained in:
parent
3046ff335f
commit
5b883de7b9
|
@ -1,15 +0,0 @@
|
||||||
build:
|
|
||||||
GO111MODULE=off go build
|
|
||||||
./example
|
|
||||||
|
|
||||||
goimports:
|
|
||||||
goimports -w *.go
|
|
||||||
|
|
||||||
prep:
|
|
||||||
go get -v -t -u
|
|
||||||
|
|
||||||
run:
|
|
||||||
go run *.go
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -f example
|
|
|
@ -1,91 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
pb "go.wit.com/lib/protobuf/virtbuf"
|
|
||||||
)
|
|
||||||
|
|
||||||
//
|
|
||||||
// saves entries in a config file
|
|
||||||
//
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
TestWriteCluster()
|
|
||||||
|
|
||||||
var c *pb.Cluster
|
|
||||||
c = pb.InitCluster()
|
|
||||||
|
|
||||||
// log.Println(aCluster.String())
|
|
||||||
// show the droplets to STDOUT
|
|
||||||
loop := c.DropletsAll() // get the list of droplets
|
|
||||||
for loop.Scan() {
|
|
||||||
d := loop.Droplet()
|
|
||||||
fmt.Println("\tdroplet =", d.Hostname, "preffered host:", d.PreferredHypervisor)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
// show the hypervisors to STDOUT
|
|
||||||
for _, h := range aCluster.Hypervisors {
|
|
||||||
fmt.Println("\thypervisor =", h.Hostname, h.GetMemoryPrintable())
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
json := aCluster.FormatJSON()
|
|
||||||
fmt.Println(json)
|
|
||||||
|
|
||||||
data, _ := aCluster.MarshalJSON()
|
|
||||||
fmt.Println(string(data))
|
|
||||||
|
|
||||||
text := aCluster.FormatTEXT()
|
|
||||||
fmt.Println(text)
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
func marshalWriteToFile(myWriter *bufio.Writer, c *pb.Cluster) {
|
|
||||||
buf, err := proto.Marshal(c)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("marshaling error: ", err)
|
|
||||||
}
|
|
||||||
tmp, err := myWriter.Write(buf)
|
|
||||||
myWriter.Flush()
|
|
||||||
log.Println("bufio.Write() tmp, err = ", tmp, err)
|
|
||||||
|
|
||||||
buf, err = proto.Marshal(c)
|
|
||||||
tmp2, err := myWriter.Write(buf)
|
|
||||||
myWriter.Flush()
|
|
||||||
log.Println("bufio.Write() tmp2, err = ", tmp2, err)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func TestWriteCluster() {
|
|
||||||
c := pb.CreateSampleCluster(7)
|
|
||||||
os.Setenv("VIRTIGO_HOME", "/tmp/virtigo/")
|
|
||||||
|
|
||||||
if err := c.ConfigSave(); err != nil {
|
|
||||||
fmt.Println("configsave error", err)
|
|
||||||
os.Exit(-1)
|
|
||||||
}
|
|
||||||
// marshalUnmarshal()
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
func marshalUnmarshal() {
|
|
||||||
test := pb.CreateSampleCluster(7)
|
|
||||||
data, err := proto.Marshal(test)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("marshaling error: ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
newTest := &pb.Cluster{}
|
|
||||||
err = proto.Unmarshal(data, newTest)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("unmarshaling error: ", err)
|
|
||||||
} else {
|
|
||||||
log.Println("proto.Marshal() and proto.Unmarshal() worked")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
Loading…
Reference in New Issue