zoopb/example/main.go

45 lines
846 B
Go
Raw Normal View History

2024-11-03 00:39:52 -05:00
package main
import (
"fmt"
"go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log"
2024-11-03 00:39:52 -05:00
)
func main() {
testPackages()
}
func testPackages() {
var all *zoopb.Packages
all = new(zoopb.Packages)
// r = zoopb.LoadJSON("go.wit.com/lib/protobuf/zoopb")
2024-11-03 00:39:52 -05:00
new1 := new(zoopb.Package)
new1.Name = "bash"
new1.Version = "5.2.21"
if all.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 all.Append(new2) {
log.Info("added", new2.Name, "ok")
} else {
log.Info("added", new2.Name, "failed")
}
if all.Append(new2) {
log.Info("added", new2.Name, "ok (this is bad)")
} else {
log.Info("added", new2.Name, "failed (but ok)")
}
fmt.Println("packages are:", len(all.Packages))
2024-11-03 00:39:52 -05:00
}