diff options
Diffstat (limited to 'example')
| -rw-r--r-- | example/Makefile | 16 | ||||
| -rw-r--r-- | example/main.go | 77 |
2 files changed, 0 insertions, 93 deletions
diff --git a/example/Makefile b/example/Makefile deleted file mode 100644 index 88d2439..0000000 --- a/example/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -build: - GO111MODULE=off go build - ./example - FORGE_HOME=/tmp/forge ./example - -goimports: - goimports -w *.go - -prep: - go get -v -t -u - -run: - go run *.go - -clean: - -rm -f example diff --git a/example/main.go b/example/main.go deleted file mode 100644 index 058412d..0000000 --- a/example/main.go +++ /dev/null @@ -1,77 +0,0 @@ -package main - -import ( - "fmt" - "os" - - "go.wit.com/lib/protobuf/forgepb" - "go.wit.com/log" -) - -func main() { - var repos *forgepb.Repos - repos = new(forgepb.Repos) - if err := repos.ConfigLoad(); err != nil { - log.Warn("forgepb.ConfigLoad() failed", err) - os.Exit(-1) - } - testAddRepos(repos) - repos.ConfigSave() -} - -func testAddRepos(all *forgepb.Repos) *forgepb.Repos { - 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") - } - - new1 = new(forgepb.Repo) - new1.Name = "zookeeper" - new1.Debname = "zookeeper-go" - if all.Append(new1) { - log.Info("added", new1.Name, "ok") - } else { - log.Info("added", new1.Name, "failed") - } - - new1 = new(forgepb.Repo) - new1.Name = "wit-package" - new1.Private = true - if all.Append(new1) { - log.Info("added", new1.Name, "ok") - } else { - log.Info("added", new1.Name, "failed") - } - - new1 = new(forgepb.Repo) - new1.Name = "networkQuality" - new1.Debname = "networkquality" - new1.Readonly = true - 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 -} |
