aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYotam Nachum <me@yotam.net>2019-11-22 16:45:23 +0200
committerYotam Nachum <me@yotam.net>2019-11-22 17:28:19 +0200
commit6f79975ce14da38b1f15e9beb6ec58b16165efb5 (patch)
treef089946f0da26ae6eae7708371d34393dd4658cb
parentAdd an option to specify custom config file (diff)
downloadshavit-6f79975ce14da38b1f15e9beb6ec58b16165efb5.tar.gz
shavit-6f79975ce14da38b1f15e9beb6ec58b16165efb5.zip
Add more tools to CI linting
-rw-r--r--.build.yml5
-rw-r--r--handler.go4
2 files changed, 7 insertions, 2 deletions
diff --git a/.build.yml b/.build.yml
index 761b965..aee27f3 100644
--- a/.build.yml
+++ b/.build.yml
@@ -1,6 +1,7 @@
image: fedora/latest
packages:
- go
+ - tar
sources:
- https://git.sr.ht/~yotam/go-gemini-server
- https://git.sr.ht/~sircmpwn/annotatego
@@ -8,8 +9,12 @@ secrets:
- f43da1db-697d-4101-8607-e96f574b035a
tasks:
- lint: |
+ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.21.0
+ go get honnef.co/go/tools/cmd/staticcheck
cd go-gemini-server
go vet
+ ~/go/bin/staticcheck
+ ~/go/bin/golangci-lint run
- test: |
cd go-gemini-server
go test
diff --git a/handler.go b/handler.go
index bba9955..9f258ec 100644
--- a/handler.go
+++ b/handler.go
@@ -28,7 +28,7 @@ func (h Handler) urlAbsPath(rawURL string) (string, error) {
}
if !strings.HasPrefix(itemPath, h.cfg.SourceDir) {
- return "", gemini.Error{Err: fmt.Errorf("Permission Denied"), Status: gemini.StatusBadRequest}
+ return "", gemini.Error{Err: fmt.Errorf("permission denied"), Status: gemini.StatusBadRequest}
}
return itemPath, nil
@@ -58,7 +58,7 @@ func (h Handler) getFilePath(rawURL string) (string, error) {
return indexPath, nil
}
- return "", gemini.Error{Err: fmt.Errorf("File Not Found"), Status: gemini.StatusNotFound}
+ return "", gemini.Error{Err: fmt.Errorf("file not found"), Status: gemini.StatusNotFound}
}
// Handle implement the gemini.Handler interface by serving files from a given source directory