Fix linter warnings

This commit is contained in:
Michael Eischer
2025-09-21 21:58:29 +02:00
parent 575eac8d80
commit 60d80a6127
13 changed files with 24 additions and 29 deletions

View File

@@ -45,10 +45,7 @@ func readPEMCertKey(filename string) (certs []byte, key []byte, err error) {
}
var block *pem.Block
for {
if len(data) == 0 {
break
}
for len(data) > 0 {
block, data = pem.Decode(data)
if block == nil {
break

View File

@@ -34,6 +34,7 @@ func isPath(s string) bool {
// check for drive paths
drive := s[0]
//nolint:staticcheck // de morgan's law makes this harder to read
if !(drive >= 'a' && drive <= 'z') && !(drive >= 'A' && drive <= 'Z') {
return false
}

View File

@@ -79,8 +79,8 @@ func TestListAPI(t *testing.T) {
t.Logf("req %v %v, accept: %v", req.Method, req.URL.Path, req.Header["Accept"])
var err error
switch {
case req.Method == "GET":
switch req.Method {
case "GET":
// list files in data/
res.Header().Set("Content-Type", test.ContentType)
_, err = res.Write([]byte(test.Data))
@@ -89,7 +89,7 @@ func TestListAPI(t *testing.T) {
t.Fatal(err)
}
return
case req.Method == "HEAD":
case "HEAD":
// stat file in data/, use the first two bytes in the name
// of the file as the size :)
filename := req.URL.Path[6:]