From 0fc7c2d753bc6cfdc4d64425da1a23c3735b8409 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 27 Nov 2024 21:05:12 -0600 Subject: boo. big mistake on naming protobufs It's important to really choose good names from the start. do not think you can rename .proto files later Good software engineering practices enforced here! no bullshit. you really want to know what you are planning. --- settings.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'settings.go') diff --git a/settings.go b/settings.go index f40bdb4..61f0d98 100644 --- a/settings.go +++ b/settings.go @@ -14,7 +14,7 @@ import ( "strings" ) -func (all *Repos) UpdateGoPath(name string, gopath string) bool { +func (all *ForgeConfigs) UpdateGoPath(name string, gopath string) bool { oldr := all.DeleteByPath(name) if oldr == nil { // nothing to update @@ -28,12 +28,12 @@ func (all *Repos) UpdateGoPath(name string, gopath string) bool { // returns true if gopath is readonly() // will attempt to match IsWritable("foo") against anything ending in "foo" -func (all *Repos) IsReadOnly(gopath string) bool { - var match *Repo +func (all *ForgeConfigs) IsReadOnly(gopath string) bool { + var match *ForgeConfig loop := all.SortByPath() // get the list of repos for loop.Scan() { - r := loop.Repo() + r := loop.Next() if r.GoPath == gopath { // exact gopath match if r.Writable { @@ -88,13 +88,13 @@ func (all *Repos) IsReadOnly(gopath string) bool { // this let's you check a git tag version against a package .deb version // allows gopath's to not need to match the .deb name // this is important in lots of cases! It is normal and happens often enough. -func (all *Repos) DebName(gopath string) string { +func (all *ForgeConfigs) DebName(gopath string) string { // get "zookeeper" from "go.wit.com/apps/zookeeper" normalBase := filepath.Base(gopath) loop := all.SortByPath() for loop.Scan() { - r := loop.Repo() + r := loop.Next() if r.GoPath == gopath { // returns "zookeeper-go" for "go.wit.com/apps/zookeeper" if r.DebName != "" { @@ -115,15 +115,15 @@ func (all *Repos) DebName(gopath string) string { // // IsPrivate("go.foo.com/jcarr/foo") returns true if private // IsPrivate("foo") also returns true if "go.bar.com/jcarr/foo" is private -func (all *Repos) IsPrivate(thing string) bool { - var match *Repo +func (all *ForgeConfigs) IsPrivate(thing string) bool { + var match *ForgeConfig // sort by path means the simple 'match' logic // here works in the sense the last directory match // is the one that is used loop := all.SortByPath() // get the list of repos for loop.Scan() { - r := loop.Repo() + r := loop.Next() if r.GoPath == thing { // if private is set here, then ok, otherwise // still check if a Directory match exists @@ -159,12 +159,12 @@ func (all *Repos) IsPrivate(thing string) bool { // file that lets you set things as favorites // so you can just go-clone a bunch of common things // on a new box or after you reset/delete your ~/go/src dir -func (all *Repos) IsFavorite(thing string) bool { - var match *Repo +func (all *ForgeConfigs) IsFavorite(thing string) bool { + var match *ForgeConfig loop := all.SortByPath() // get the list of repos for loop.Scan() { - r := loop.Repo() + r := loop.Next() if r.GoPath == thing { if r.Favorite { return true -- cgit v1.2.3