summaryrefslogtreecommitdiff
path: root/exit.go
blob: b091f2053d6c09458801138853876253b027184a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main

import (
	"fmt"

	"go.wit.com/lib/protobuf/argvpb"
	"go.wit.com/lib/protobuf/gitpb"
	"go.wit.com/log"
)

func okExit(check *gitpb.Repo, msg string) {
	log.Info("exit() go-mod-clean on", check.Namespace, "ok")
	log.DaemonMode(true)
	argvpb.GoodExit(msg)
}

func badExit(check *gitpb.Repo, err error) {
	log.DaemonMode(true)
	if check != nil {
		if argv.Strict != nil {
			// if in strict mode, remove the go.mod and go.sum
			eraseGoMod(check)
		}
	}
	s := fmt.Sprintf("failed in %s", check.FullPath)
	argvpb.BadExit(s, err)
}