dashboard / erock/git-pr / gofumpt and modernize #74 rss

accepted · opened on 2025-08-21T18:53:46Z by jolheiser
Help
checkout latest patchset:
ssh pr.pico.sh print pr-74 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print ps-X | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 74
add review to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add --review 74
accept PR:
ssh pr.pico.sh pr accept 74
close PR:
ssh pr.pico.sh pr close 74

Logs

jolheiser created pr with ps-146 on 2025-08-21T18:53:46Z
erock changed status on 2025-08-22T13:20:20Z {"status":"accepted"}

Patchsets

ps-146 by jolheiser on 2025-08-21T18:53:46Z

Patchset ps-146

gofumpt and modernize

jolheiser
2025-08-21T18:50:05Z
util.go
+7 -5
web.go
+1 -7
Back to top

gofumpt and modernize

This is the result of running:
- gofumpt -> https://github.com/mvdan/gofumpt
- modernize -> https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize

Signed-off-by: jolheiser <git@jolheiser.com>
range_diff.go link
+4 -2
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
diff --git a/range_diff.go b/range_diff.go
index 01dce50..577cc5f 100644
--- a/range_diff.go
+++ b/range_diff.go
@@ -11,8 +11,10 @@ import (
 	"github.com/sergi/go-diff/diffmatchpatch"
 )
 
-var COST_MAX = 65536
-var RANGE_DIFF_CREATION_FACTOR_DEFAULT = 60
+var (
+	COST_MAX                           = 65536
+	RANGE_DIFF_CREATION_FACTOR_DEFAULT = 60
+)
 
 type PatchRange struct {
 	*Patch
util.go link
+7 -5
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/util.go b/util.go
index 26f0281..8b611ab 100644
--- a/util.go
+++ b/util.go
@@ -15,11 +15,13 @@ import (
 	"github.com/charmbracelet/ssh"
 )
 
-var baseCommitRe = regexp.MustCompile(`base-commit: (.+)\s*`)
-var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
-var startOfPatch = "From "
-var patchsetPrefix = "ps-"
-var prPrefix = "pr-"
+var (
+	baseCommitRe   = regexp.MustCompile(`base-commit: (.+)\s*`)
+	letters        = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
+	startOfPatch   = "From "
+	patchsetPrefix = "ps-"
+	prPrefix       = "pr-"
+)
 
 // https://stackoverflow.com/a/22892986
 func randSeq(n int) string {
web.go link
+1 -7
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
diff --git a/web.go b/web.go
index 468847c..08dbfe1 100644
--- a/web.go
+++ b/web.go
@@ -718,13 +718,7 @@ func createPrDetail(page string) http.HandlerFunc {
 				}
 
 				// highlight review
-				isReview := false
-				for _, pID := range reviewIDs {
-					if pID == patch.ID {
-						isReview = true
-						break
-					}
-				}
+				isReview := slices.Contains(reviewIDs, patch.ID)
 
 				patchFiles := []*PatchFile{}
 				for _, file := range diffFiles {