// Copyright 2017-2025 WIT.COM Inc. All rights reserved. // Use of this source code is governed by the GPL 3.0 package main import ( "path/filepath" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) func doVerify() (string, error) { var s string = "doVerify()" var err error if argv.Verify.Stats != nil { s, err = doStats() } if argv.Verify.Namespace != nil { s, err = doVerifyNamespace() } 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) log.Info(newpath, gowork, "is gowork. fullpath:", 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() { newpath := cleanNamespace(r) if newpath != "" && newpath != r.Namespace { log.Info("Changed", r.FullPath, "to", r.Namespace) r.Namespace = newpath } else { log.Info("Not Changed", r.Namespace, newpath) } } if changed { me.forge.Repos.SaveVerbose() } return s, err }