diff options
| author | Jeff Carr <[email protected]> | 2024-11-21 10:37:01 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-21 10:37:01 -0600 |
| commit | 3adf07b442c62bd70e7bf37d4c07e51464b25e09 (patch) | |
| tree | 3c8de211fa0f245e8013d7997d3d782d11f97c3b /update.go | |
| parent | 5633f4204d6bfbce643f1fc6f74f988446c2b8c0 (diff) | |
hmmm
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'update.go')
| -rw-r--r-- | update.go | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/update.go b/update.go deleted file mode 100644 index 27e23ee..0000000 --- a/update.go +++ /dev/null @@ -1,91 +0,0 @@ -package forgepb - -import "strings" - -func (all *Repos) UpdateGoPath(name string, gopath string) bool { - oldr := all.DeleteByPath(name) - if oldr == nil { - // nothing to update - return false - } - - // update gopath and append it back to the list - oldr.GoPath = gopath - return all.Append(oldr) -} - -// returns true if gopath is readonly() -func (all *Repos) IsReadOnly(gopath string) bool { - var match *Repo - - loop := all.SortByPath() // get the list of repos - for loop.Scan() { - r := loop.Repo() - if r.GoPath == gopath { - // exact gopath match - if r.Writable { - return false - } - if r.ReadOnly { - return true - } - // private is assumed to be r/w unless above is specifically set - if r.Private { - return false - } - } - // search for potential dir matches - if r.Directory { - // test the dir - if strings.HasPrefix(gopath, r.GoPath) { - match = r - } - } - } - - // take the settings from the directory match - if match.Writable { - return false - } - if match.ReadOnly { - return true - } - // private is assumed to be r/w unless above is specifically set - if match.Private { - return false - } - - // always assume readonly - return true -} - -// is this a non-publishable repo? -func (all *Repos) IsPrivate(gopath string) bool { - var match *Repo - - loop := all.SortByPath() // get the list of repos - for loop.Scan() { - r := loop.Repo() - if r.GoPath == gopath { - // if private is set here, then ok, otherwise - // still check if a Directory match exists - if r.Private { - return true - } - } - // search for potential dir matches - if r.Directory { - // test the dir - if strings.HasPrefix(gopath, r.GoPath) { - match = r - } - } - } - - if match.Private { - return true - } - - // otherwise, assume not private - return true -} |
