autogenpb/example/main.go

42 lines
616 B
Go

//go:build go1.20
// +build go1.20
package main
import (
"os"
"go.wit.com/log"
)
// sent via -ldflags
var VERSION string
var BUILDTIME string
var sortmap map[string]string
var marshalKeys []string
var uniqueKeys []string
var pb *Fruits
func main() {
pb = NewFruits()
fruit := &Fruit{
Brand: "mom",
City: "New NewYork",
}
if pb.AppendUnique(fruit) {
log.Info("AppendUnique() ok")
} else {
log.Info("AppendUnique() failed")
os.Exit(-1)
}
if pb.AppendUnique(fruit) {
log.Info("AppendUnique() worked but should not have")
os.Exit(-1)
} else {
log.Info("AppendUnique() failed ok")
}
}