summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-05-29 19:17:50 -0500
committerJeff Carr <[email protected]>2025-05-29 19:17:50 -0500
commita29e10e9116f4d5ab80210b3eb8e25b674d3338f (patch)
treeb6182f8668da2dd246092f6fe6c7dad0093d3121 /main.go
parent2b85f5e17dda4bea2b9403668c66e291dfa67591 (diff)
Diffstat (limited to 'main.go')
-rw-r--r--main.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/main.go b/main.go
index f05ef97..2818d1f 100644
--- a/main.go
+++ b/main.go
@@ -25,7 +25,6 @@ var configSave bool
func main() {
var check *gitpb.Repo
- log.Info("go-mod-clean version", VERSION, "built on", BUILDTIME)
pp = arg.MustParse(&argv)
if argv.Bash {
@@ -36,6 +35,8 @@ func main() {
argv.doBashAuto()
os.Exit(0)
}
+
+ log.Info("go-mod-clean version", VERSION, "built on", BUILDTIME)
// load the ~/.config/forge/ config
// this lets you configure repos you have read/write access too
forge = forgepb.InitPB() // todo: make this scan only if pb file not found
@@ -48,8 +49,9 @@ func main() {
}
// deletes all the git notes
- if argv.Purge {
- purgeNotes(check)
+ if argv.Purge != nil {
+ purgeNotes(check) // purges all the 'git notes'
+ eraseGoMod(check) // erase the go.mod and go.sum files
okExit(check, "notes gone")
}
@@ -61,14 +63,14 @@ func main() {
okExit(check, "go.mod and go.sum restored from ~/go/pkg/mod/")
}
- if argv.Strict {
+ if argv.Strict != nil {
log.Info("Starting --strict mode")
if err := doStrict(check); err != nil {
badExit(check, err)
}
okExit(check, "go.mod seems clean")
}
- if argv.Smart {
+ if argv.Smart != nil {
// best effort
if err := doSmart(check); err != nil {
// badExit(check, err)
@@ -93,13 +95,13 @@ func findPwdRepo() *gitpb.Repo {
if strings.HasPrefix(pwd, forge.GetGoSrc()) {
gopath := strings.TrimPrefix(pwd, forge.GetGoSrc())
gopath = strings.Trim(gopath, "/")
- log.Info("findRepo() trying gopath", gopath)
check = forge.FindByGoPath(gopath)
if check != nil {
- log.Info("findRepo() worked", check.GetGoPath())
+ log.Info(check.GetGoPath(), "was found ok in forge")
return check
}
}
+ log.Info("findRepo() forge could not find GO path:", pwd)
return nil
}