summaryrefslogtreecommitdiff
path: root/example/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-20 09:31:24 -0600
committerJeff Carr <[email protected]>2024-11-20 09:31:24 -0600
commit35a2db858f1635f947c2b5f9bbfe9bb64ef7a472 (patch)
tree95eb14b030eeb7f5899ce300a3cfc7fed6338651 /example/main.go
Day 1v0.0.1
Diffstat (limited to 'example/main.go')
-rw-r--r--example/main.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/example/main.go b/example/main.go
new file mode 100644
index 0000000..bc6b8a4
--- /dev/null
+++ b/example/main.go
@@ -0,0 +1,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
+}