summaryrefslogtreecommitdiff
path: root/example/main.go
blob: 622270119b63447bf939a7011630072cb1fd46d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//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")
	}
}