diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-01 20:20:00 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-01 20:20:00 +0200 |
commit | d0e0c1eb99303e1000140d4b98c610077278dc42 (patch) | |
tree | 30f9bc8dba73df5a6bdf2fc20041120881fe4e57 /pkg/handler/git/handler.go | |
parent | e3705f35c642e578625ce4574d189fa0b0869403 (diff) | |
download | cerrado-d0e0c1eb99303e1000140d4b98c610077278dc42.tar.gz cerrado-d0e0c1eb99303e1000140d4b98c610077278dc42.tar.bz2 cerrado-d0e0c1eb99303e1000140d4b98c610077278dc42.zip |
ref: Remove mux
Diffstat (limited to 'pkg/handler/git/handler.go')
-rw-r--r-- | pkg/handler/git/handler.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go index b77bcfc..e2f4042 100644 --- a/pkg/handler/git/handler.go +++ b/pkg/handler/git/handler.go @@ -8,7 +8,6 @@ import ( "git.gabrielgio.me/cerrado/templates" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" - "github.com/gorilla/mux" ) type ( @@ -43,7 +42,7 @@ func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) { } func (g *GitHandler) Summary(w http.ResponseWriter, r *http.Request) { - name := mux.Vars(r)["name"] + name := r.PathValue("name") ref, err := g.gitService.GetHead(name) if err != nil { slog.Error("Error loading head", "error", err) @@ -59,7 +58,7 @@ func (g *GitHandler) Summary(w http.ResponseWriter, r *http.Request) { } func (g *GitHandler) About(w http.ResponseWriter, r *http.Request) { - name := mux.Vars(r)["name"] + name := r.PathValue("name") ref, err := g.gitService.GetHead(name) if err != nil { slog.Error("Error loading head", "error", err) @@ -74,7 +73,7 @@ func (g *GitHandler) About(w http.ResponseWriter, r *http.Request) { } func (g *GitHandler) Refs(w http.ResponseWriter, r *http.Request) { - name := mux.Vars(r)["name"] + name := r.PathValue("name") tags, err := g.gitService.ListTags(name) if err != nil { @@ -106,8 +105,8 @@ func (g *GitHandler) Refs(w http.ResponseWriter, r *http.Request) { } func (g *GitHandler) Tree(w http.ResponseWriter, r *http.Request) { - name := mux.Vars(r)["name"] - ref := mux.Vars(r)["ref"] + name := r.PathValue("name") + ref := r.PathValue("ref") gitList := &templates.GitItemPage{ Name: name, Ref: ref, @@ -117,8 +116,8 @@ func (g *GitHandler) Tree(w http.ResponseWriter, r *http.Request) { } func (g *GitHandler) Log(w http.ResponseWriter, r *http.Request) { - name := mux.Vars(r)["name"] - ref := mux.Vars(r)["ref"] + name := r.PathValue("name") + ref := r.PathValue("ref") commits, err := g.gitService.ListCommits(name, ref) if err != nil { |