never put binaries in go libraries
This commit is contained in:
parent
5bd3de1f9a
commit
a4f3f95196
|
@ -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,71 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"go.wit.com/lib/protobuf/zoopb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
m := testMachine()
|
||||
testPackages(m)
|
||||
|
||||
loop := m.Packages.SortByName()
|
||||
for loop.Scan() {
|
||||
p := loop.Package()
|
||||
log.Info("installed package:", p.Name, p.Version, p.PkgName)
|
||||
}
|
||||
|
||||
if m.IsInstalled("bash") {
|
||||
log.Info("bash installed check worked")
|
||||
} else {
|
||||
log.Info("bash installed check failed")
|
||||
panic("bash")
|
||||
}
|
||||
|
||||
if m.IsInstalled("foo") {
|
||||
log.Info("foo not-installed check failed")
|
||||
panic("foo")
|
||||
} else {
|
||||
log.Info("foo not-installed check worked")
|
||||
}
|
||||
}
|
||||
|
||||
func testMachine() *zoopb.Machine {
|
||||
var m *zoopb.Machine
|
||||
m = new(zoopb.Machine)
|
||||
m.Hostname = "zookeeper"
|
||||
return m
|
||||
}
|
||||
|
||||
func testPackages(m *zoopb.Machine) {
|
||||
m.Packages = new(zoopb.Packages)
|
||||
// r = zoopb.LoadJSON("go.wit.com/lib/protobuf/zoopb")
|
||||
|
||||
new1 := new(zoopb.Package)
|
||||
new1.Name = "bash"
|
||||
new1.Version = "5.2.21"
|
||||
if m.Packages.Append(new1) {
|
||||
log.Info("added", new1.Name, "ok")
|
||||
} else {
|
||||
log.Info("added", new1.Name, "failed")
|
||||
}
|
||||
|
||||
new2 := new(zoopb.Package)
|
||||
new2.Name = "go-clone"
|
||||
new2.Version = "0.6.8" // good version of the macos
|
||||
if m.Packages.Append(new2) {
|
||||
log.Info("added", new2.Name, "ok")
|
||||
} else {
|
||||
log.Info("added", new2.Name, "failed")
|
||||
}
|
||||
|
||||
if m.Packages.Append(new2) {
|
||||
log.Info("added", new2.Name, "ok (this is bad)")
|
||||
} else {
|
||||
log.Info("added", new2.Name, "failed (but ok)")
|
||||
}
|
||||
|
||||
fmt.Println("package count = ", m.Packages.Len())
|
||||
}
|
Loading…
Reference in New Issue