address linter complaints
4 files changed, 12 insertions(+), 12 deletions(-)
M git/service/service.go → git/service/service.go
@@ -18,13 +18,13 @@ const timeout = 1 * time.Minute // Mostly from charmbracelet/soft-serve and sosedoff/gitkit. -type ServiceCommand struct { +type Command struct { Dir string Stdin io.Reader Stdout http.ResponseWriter } -func (c *ServiceCommand) InfoRefs(ctx context.Context) error { +func (c *Command) InfoRefs(ctx context.Context) error { ctx, cancel := context.WithTimeout(ctx, timeout) defer cancel() cmd := exec.CommandContext(ctx, "git", []string{@@ -79,7 +79,7 @@ return nil } -func (c *ServiceCommand) UploadPack(ctx context.Context) (err error) { +func (c *Command) UploadPack(ctx context.Context) (err error) { ctx, cancel := context.WithTimeout(ctx, timeout) defer cancel() cmd := exec.CommandContext(ctx, "git", []string{
M routes/git.go → routes/git.go
@@ -24,7 +24,7 @@ w.Header().Set("content-type", "application/x-git-upload-pack-advertisement") w.Header().Set("cache-control", "no-cache") w.WriteHeader(http.StatusOK) - cmd := service.ServiceCommand{ + cmd := service.Command{ Dir: repo, Stdout: w, }@@ -54,7 +54,7 @@ w.Header().Set("Transfer-Encoding", "chunked") w.Header().Set("cache-control", "no-cache") w.WriteHeader(http.StatusOK) - cmd := service.ServiceCommand{ + cmd := service.Command{ Dir: repo, Stdout: w, }
M routes/handler.go → routes/handler.go
@@ -44,13 +44,14 @@ return } - if rest == "info/refs" && + switch { + case rest == "info/refs" && r.URL.RawQuery == "service=git-upload-pack" && - r.Method == "GET" { + r.Method == "GET": d.InfoRefs(w, r, params) - } else if rest == "git-upload-pack" && r.Method == "POST" { + case rest == "git-upload-pack" && r.Method == "POST": d.UploadPack(w, r, params) - } else if r.Method == "GET" { + case r.Method == "GET": if fixed, found := strings.CutSuffix(r.URL.Path, "/"); found { http.Redirect(w, r, fixed, http.StatusPermanentRedirect) } else {
M unveil_stub.go → unveil_stub.go
@@ -1,11 +1,10 @@ //go:build !openbsd -// +build !openbsd // Stub functions for GOOS that don't support unix.Unveil() package main -func Unveil(path string, perms string) error { +func Unveil(_ string, _ string) error { return nil }@@ -13,6 +12,6 @@ func UnveilBlock() error { return nil } -func UnveilPaths(paths []string, perms string) error { +func UnveilPaths(_ []string, _ string) error { return nil }