summaryrefslogtreecommitdiff
path: root/doVerify.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-28 12:11:57 -0500
committerJeff Carr <[email protected]>2025-10-28 12:11:57 -0500
commitb5240fccf2df4a6f2a4ee99847a9d5c3901fe4a5 (patch)
tree8a7c8f05adbd7fb60a83ede4559a689bce12fb29 /doVerify.go
parent36d269f041abcc49bbdd754fb9f0c348283376e9 (diff)
better argv handling
Diffstat (limited to 'doVerify.go')
-rw-r--r--doVerify.go76
1 files changed, 0 insertions, 76 deletions
diff --git a/doVerify.go b/doVerify.go
deleted file mode 100644
index 846c4b9..0000000
--- a/doVerify.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
-// Use of this source code is governed by the GPL 3.0
-
-package main
-
-import (
- "errors"
- "path/filepath"
-
- "go.wit.com/lib/env"
- "go.wit.com/lib/protobuf/gitpb"
- "go.wit.com/log"
-)
-
-func doVerify() (string, error) {
- var s string = "doVerify()"
- var err error
-
- if argv.Verify.Namespace != nil {
- s, err = doVerifyNamespace()
- }
-
- return s, err
-}
-
-func cleanNamespace(r *gitpb.Repo) string {
- // check for GO repos
- gowork := env.Get("gopath")
- // todo: detect if using go.work file
- newpath, err := filepath.Rel(gowork, r.FullPath)
- // log.Info("cleanNamespace()", newpath, gowork, "is gowork. fullpath:", r.FullPath)
- if err == nil {
- // log.Info("cleanNamespace returned", newpath)
- // relative path to gosrc or gowork is the namespace
- return newpath
- }
- log.Info("cleanNamespace got err", newpath, err)
- // 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 counter int
- for r := range me.forge.Repos.IterAll() {
- newpath := cleanNamespace(r)
- if newpath == "" {
- // log.Info("didn't work", r.Namespace, "to", newpath)
- // didn't work
- } else if newpath == r.Namespace {
- // already good namespace.
- continue
- } else if newpath != r.Namespace {
- counter += 1
- log.Info("Changed", r.FullPath, "to", newpath)
- r.Namespace = newpath
- continue
- }
- counter += 1
- log.Info("cleanNamespace() didn't match", r.Namespace)
- }
- if counter != 0 {
- err = errors.New(log.Sprintf("%d namespaces were invalid", counter))
- }
-
- if env.True("DryRun") {
- return s, err
- }
- if counter != 0 {
- me.forge.Repos.SaveVerbose()
- }
-
- return s, err
-}