summaryrefslogtreecommitdiff
path: root/example/main.go
blob: bc6b8a464160ff7f672c8d202959e74f6fca8871 (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
42
43
44
45
46
package main

import (
	"fmt"

	"go.wit.com/lib/protobuf/forgepb"
	"go.wit.com/log"
)

func main() {
	repos := testRepos()
	repos.ConfigSave()
}

func testRepos() *forgepb.Repos {
	var all *forgepb.Repos
	all = new(forgepb.Repos)
	// r = forgepb.LoadJSON("go.wit.com/lib/protobuf/forgepb")

	new1 := new(forgepb.Repo)
	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(forgepb.Repo)
	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.Repos))
	return all
}