Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/zoekt-webserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func main() {
err = srv.ListenAndServe()
}

if err != http.ErrServerClosed {
if !errors.Is(err, http.ErrServerClosed) {
// Fatal otherwise shutdownOnSignal will block
log.Fatalf("ListenAndServe: %v", err)
}
Expand Down
5 changes: 3 additions & 2 deletions gitindex/catfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"bufio"
"bytes"
"encoding/hex"
"errors"
"fmt"
"io"
"os/exec"
Expand Down Expand Up @@ -235,8 +236,8 @@ func (cr *catfileReader) Close() error {

// isKilledErr reports whether err is an exec.ExitError caused by SIGKILL.
func isKilledErr(err error) bool {
exitErr, ok := err.(*exec.ExitError)
if !ok {
var exitErr *exec.ExitError
if !errors.As(err, &exitErr) {
return false
}
ws, ok := exitErr.Sys().(syscall.WaitStatus)
Expand Down
2 changes: 1 addition & 1 deletion gitindex/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ func catfileFilterSpec(opts Options) string {

func newIgnoreMatcher(tree *object.Tree) (*ignore.Matcher, error) {
ignoreFile, err := tree.File(ignore.IgnoreFile)
if err == object.ErrFileNotFound {
if errors.Is(err, object.ErrFileNotFound) {
return &ignore.Matcher{}, nil
}
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"archive/zip"
"bytes"
"compress/gzip"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -114,7 +115,7 @@ func newZipArchive(r io.Reader, closer io.Closer) (*zipArchive, error) {
func detectContentType(r io.Reader) (string, io.Reader, error) {
var buf [512]byte
n, err := io.ReadFull(r, buf[:])
if err != nil && err != io.ErrUnexpectedEOF {
if err != nil && !errors.Is(err, io.ErrUnexpectedEOF) {
return "", nil, err
}

Expand Down
3 changes: 2 additions & 1 deletion search/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package search

import (
"errors"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -244,7 +245,7 @@ func (s *DirectoryWatcher) watch() error {
case err := <-watcher.Errors:
// Ignore ErrEventOverflow since we rely on the presence of events so
// safe to ignore.
if err != nil && err != fsnotify.ErrEventOverflow {
if err != nil && !errors.Is(err, fsnotify.ErrEventOverflow) {
log.Println("[ERROR] watcher error:", err)
}

Expand Down
Loading