about summary refs log tree commit diff stats
path: root/internal
diff options
context:
space:
mode:
authorAlan Pearce2025-01-24 22:15:46 +0100
committerAlan Pearce2025-01-24 22:18:34 +0100
commit51a9cf280ff4045b360519ef8cc1ee4203a2c7bc (patch)
tree4ee7550a9586d4ef8d3cba20bbaa2e75fab165c2 /internal
parent177955eab572c13b7d99217e54250f377c9a3c9e (diff)
downloadwebsite-51a9cf280ff4045b360519ef8cc1ee4203a2c7bc.tar.lz
website-51a9cf280ff4045b360519ef8cc1ee4203a2c7bc.tar.zst
website-51a9cf280ff4045b360519ef8cc1ee4203a2c7bc.zip
fix linter complaints
Diffstat (limited to 'internal')
-rw-r--r--internal/server/server.go2
-rw-r--r--internal/vcs/repository.go8
2 files changed, 8 insertions, 2 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index 9c7b907..0b67a69 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -190,7 +190,7 @@ func New(runtimeConfig *Config, log *log.Logger) (*Server, error) {
 		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(
diff --git a/internal/vcs/repository.go b/internal/vcs/repository.go
index 5950e53..06a4733 100644
--- a/internal/vcs/repository.go
+++ b/internal/vcs/repository.go
@@ -82,6 +82,9 @@ func (r *Repository) Update() (bool, error) {
 	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 @@ func (r *Repository) Update() (bool, error) {
 	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)