summaryrefslogtreecommitdiff
path: root/checkDirty.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-04 15:37:31 -0600
committerJeff Carr <[email protected]>2024-12-04 15:37:31 -0600
commit77cd0ae36e79748b56e9bf0964fee677631f9fd0 (patch)
tree7965bc6b2daf204a56d13f1a9ba0a99245115e0c /checkDirty.go
parent4a64e3a7c292c4976eaa80891ccaff09a62e8dc2 (diff)
always run goimports. misc other changes
Diffstat (limited to 'checkDirty.go')
-rw-r--r--checkDirty.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/checkDirty.go b/checkDirty.go
index 0db0ff4..83b049d 100644
--- a/checkDirty.go
+++ b/checkDirty.go
@@ -35,11 +35,22 @@ func (repo *Repo) CheckDirty() bool {
return true
}
- if len(r.Stdout) == 0 {
- repo.Dirty = false
- return false
+ // dirty if anything but go.mod and go.sum
+ var bad bool = false
+ for _, line := range r.Stdout {
+ parts := strings.Fields(line)
+ if len(parts) == 2 {
+ switch parts[1] {
+ case "go.mod":
+ case "go.sum":
+ default:
+ bad = true
+ }
+ } else {
+ bad = true
+ }
}
- repo.Dirty = true
- return true
+
+ return bad
}