repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

commit
5846087
parent
9dd158e
author
jolheiser
date
2025-08-21 14:50:05 -0400 EDT
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>
3 files changed,  +12, -14
M web.go
M range_diff.go
+4, -2
 1@@ -11,8 +11,10 @@ import (
 2 	"github.com/sergi/go-diff/diffmatchpatch"
 3 )
 4 
 5-var COST_MAX = 65536
 6-var RANGE_DIFF_CREATION_FACTOR_DEFAULT = 60
 7+var (
 8+	COST_MAX                           = 65536
 9+	RANGE_DIFF_CREATION_FACTOR_DEFAULT = 60
10+)
11 
12 type PatchRange struct {
13 	*Patch
M util.go
+7, -5
 1@@ -15,11 +15,13 @@ import (
 2 	"github.com/charmbracelet/ssh"
 3 )
 4 
 5-var baseCommitRe = regexp.MustCompile(`base-commit: (.+)\s*`)
 6-var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
 7-var startOfPatch = "From "
 8-var patchsetPrefix = "ps-"
 9-var prPrefix = "pr-"
10+var (
11+	baseCommitRe   = regexp.MustCompile(`base-commit: (.+)\s*`)
12+	letters        = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
13+	startOfPatch   = "From "
14+	patchsetPrefix = "ps-"
15+	prPrefix       = "pr-"
16+)
17 
18 // https://stackoverflow.com/a/22892986
19 func randSeq(n int) string {
M web.go
+1, -7
 1@@ -718,13 +718,7 @@ func createPrDetail(page string) http.HandlerFunc {
 2 				}
 3 
 4 				// highlight review
 5-				isReview := false
 6-				for _, pID := range reviewIDs {
 7-					if pID == patch.ID {
 8-						isReview = true
 9-						break
10-					}
11-				}
12+				isReview := slices.Contains(reviewIDs, patch.ID)
13 
14 				patchFiles := []*PatchFile{}
15 				for _, file := range diffFiles {