diff options
| author | Jeff Carr <[email protected]> | 2025-10-16 02:34:46 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-16 02:34:46 -0500 |
| commit | 40f8dd494e6a4a8ec3c3fa8c98ccdb74efff72eb (patch) | |
| tree | 5dcfbe68ac31c8491d3f627a264364098a0d4409 /doVerify.go | |
| parent | 246771554e3b9abc8d070864c0c90de3d4647b58 (diff) | |
namespace checks
Diffstat (limited to 'doVerify.go')
| -rw-r--r-- | doVerify.go | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/doVerify.go b/doVerify.go index 79231f7..90e65c2 100644 --- a/doVerify.go +++ b/doVerify.go @@ -4,8 +4,9 @@ package main import ( - "strings" + "path/filepath" + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -24,15 +25,35 @@ func doVerify() (string, error) { return s, err } +func cleanNamespace(r *gitpb.Repo) string { + // check for GO repos + gowork := me.forge.Config.ReposDir + // todo: detect if using go.work file + newpath, err := filepath.Rel(gowork, r.FullPath) + if err != nil { + // relative path to gosrc or gowork is the namespace + return newpath + } + // check for other stuff. use the URLs + return "" +} + // checks to see if the r.Namespace seems right func doVerifyNamespace() (string, error) { var s string = "doVerifyNamespace()" var err error + var changed bool for r := range me.forge.Repos.IterAll() { - if strings.HasPrefix(r.FullPath, r.Namespace) { - log.Info("look at:", r.FullPath, r.Namespace) + newpath := cleanNamespace(r) + if newpath != "" && newpath != r.Namespace { + log.Info("Changed", r.FullPath, "to", r.Namespace) + r.Namespace = newpath } } + if changed { + me.forge.Repos.SaveVerbose() + } + return s, err } |
