Remove Golint

- Golint is deprecated
- Use staticcheck and golangci-lint instead
This commit is contained in:
Frédéric Guillot 2024-02-24 20:44:40 -08:00
parent b48ad6dbfb
commit 420a3d4d95
4 changed files with 15 additions and 8 deletions

View file

@ -27,6 +27,11 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- run: "go vet ./..."
- uses: golangci/golangci-lint-action@v4
with:
args: --timeout 10m --skip-dirs tests --disable errcheck --enable sqlclosecheck --enable misspell --enable gofmt --enable goimports --enable whitespace
- uses: dominikh/staticcheck-action@v1.3.0
with:
version: "2023.1.7"
install-go: false

View file

@ -110,7 +110,9 @@ test:
go test -cover -race -count=1 ./...
lint:
golint -set_exit_status ${PKG_LIST}
go vet ./...
staticcheck ./...
golangci-lint run --disable errcheck --enable sqlclosecheck --enable misspell --enable gofmt --enable goimports --enable whitespace
integration-test:
psql -U postgres -c 'drop database if exists miniflux_test;'

View file

@ -77,7 +77,7 @@ func (h *handler) updateUser(w http.ResponseWriter, r *http.Request) {
}
if userModificationRequest.IsAdmin != nil && *userModificationRequest.IsAdmin {
json.BadRequest(w, r, errors.New("Only administrators can change permissions of standard users"))
json.BadRequest(w, r, errors.New("only administrators can change permissions of standard users"))
return
}
}
@ -141,7 +141,7 @@ func (h *handler) userByID(w http.ResponseWriter, r *http.Request) {
userID := request.RouteInt64Param(r, "userID")
user, err := h.store.UserByID(userID)
if err != nil {
json.BadRequest(w, r, errors.New("Unable to fetch this user from the database"))
json.BadRequest(w, r, errors.New("unable to fetch this user from the database"))
return
}
@ -163,7 +163,7 @@ func (h *handler) userByUsername(w http.ResponseWriter, r *http.Request) {
username := request.RouteStringParam(r, "username")
user, err := h.store.UserByUsername(username)
if err != nil {
json.BadRequest(w, r, errors.New("Unable to fetch this user from the database"))
json.BadRequest(w, r, errors.New("unable to fetch this user from the database"))
return
}
@ -194,7 +194,7 @@ func (h *handler) removeUser(w http.ResponseWriter, r *http.Request) {
}
if user.ID == request.UserID(r) {
json.BadRequest(w, r, errors.New("You cannot remove yourself"))
json.BadRequest(w, r, errors.New("you cannot remove yourself"))
return
}

View file

@ -12,11 +12,11 @@ import (
// ValidateRange makes sure the offset/limit values are valid.
func ValidateRange(offset, limit int) error {
if offset < 0 {
return fmt.Errorf(`Offset value should be >= 0`)
return fmt.Errorf(`offset value should be >= 0`)
}
if limit < 0 {
return fmt.Errorf(`Limit value should be >= 0`)
return fmt.Errorf(`limit value should be >= 0`)
}
return nil
@ -29,7 +29,7 @@ func ValidateDirection(direction string) error {
return nil
}
return fmt.Errorf(`Invalid direction, valid direction values are: "asc" or "desc"`)
return fmt.Errorf(`invalid direction, valid direction values are: "asc" or "desc"`)
}
// IsValidRegex verifies if the regex can be compiled.