fix linter complaints
Alan Pearce alan@alanpearce.eu
Fri, 24 Jan 2025 22:15:46 +0100
2 files changed, 8 insertions(+), 2 deletions(-)
M internal/server/server.go → internal/server/server.go
@@ -190,7 +190,7 @@ ) replace := "${1}." + config.Domains[0] loggingMux.Handle(config.BaseURL.Hostname()+"/", mux) loggingMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - switch true { + switch { case slices.Contains(config.Domains, r.Host): path, _ := website.CanonicalisePath(r.URL.Path) http.Redirect(
M internal/vcs/repository.go → internal/vcs/repository.go
@@ -82,6 +82,9 @@ } refs, err := rem.List(&git.ListOptions{ Timeout: 5, }) + if err != nil { + return false, err + } var hash plumbing.Hash for _, ref := range refs { @@ -94,10 +97,13 @@ wt, err := r.repo.Worktree() if err != nil { return false, err } - wt.Checkout(&git.CheckoutOptions{ + err = wt.Checkout(&git.CheckoutOptions{ Hash: hash, Force: true, }) + if err != nil { + return false, err + } r.log.Info("updated to", "rev", hash)