chore: update golangci-lint config

This commit is contained in:
steven
2023-09-22 17:55:26 +08:00
committed by Steven
parent a58ebd27ca
commit 07e0bb2d4c
42 changed files with 195 additions and 137 deletions

View File

@ -6,10 +6,11 @@ import (
"net/http"
"strconv"
"github.com/boojack/slash/store"
"github.com/labstack/echo/v4"
"github.com/mssola/useragent"
"golang.org/x/exp/slices"
"github.com/boojack/slash/store"
)
type ReferenceInfo struct {

View File

@ -7,12 +7,13 @@ import (
"net/http"
"time"
"github.com/boojack/slash/api/auth"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/store"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
"golang.org/x/crypto/bcrypt"
"github.com/boojack/slash/api/auth"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/store"
)
type SignInRequest struct {

View File

@ -5,13 +5,14 @@ import (
"net/http"
"strings"
"github.com/golang-jwt/jwt/v4"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
"github.com/boojack/slash/api/auth"
"github.com/boojack/slash/internal/util"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/store"
"github.com/golang-jwt/jwt/v4"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
)
const (

View File

@ -8,10 +8,11 @@ import (
"net/url"
"strings"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/store"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/store"
)
func (s *APIV1Service) registerRedirectorRoutes(g *echo.Group) {

View File

@ -7,11 +7,12 @@ import (
"net/http"
"strings"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
"github.com/boojack/slash/internal/util"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/store"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
)
// Visibility is the type of a shortcut visibility.

View File

@ -6,10 +6,12 @@ import (
"net/http"
"net/mail"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
"golang.org/x/crypto/bcrypt"
"github.com/boojack/slash/internal/util"
"github.com/boojack/slash/store"
"github.com/labstack/echo/v4"
"golang.org/x/crypto/bcrypt"
)
const (
@ -60,13 +62,13 @@ type CreateUserRequest struct {
func (create CreateUserRequest) Validate() error {
if create.Email != "" && !validateEmail(create.Email) {
return fmt.Errorf("invalid email format")
return errors.New("invalid email format")
}
if create.Nickname != "" && len(create.Nickname) < 3 {
return fmt.Errorf("nickname is too short, minimum length is 3")
return errors.New("nickname is too short, minimum length is 3")
}
if len(create.Password) < 3 {
return fmt.Errorf("password is too short, minimum length is 3")
return errors.New("password is too short, minimum length is 3")
}
return nil

View File

@ -2,7 +2,8 @@ package v1
import (
"encoding/json"
"fmt"
"github.com/pkg/errors"
)
type UserSettingKey string
@ -39,7 +40,7 @@ func (upsert UserSettingUpsert) Validate() error {
localeValue := "en"
err := json.Unmarshal([]byte(upsert.Value), &localeValue)
if err != nil {
return fmt.Errorf("failed to unmarshal user setting locale value")
return errors.New("failed to unmarshal user setting locale value")
}
invalid := true
@ -50,10 +51,10 @@ func (upsert UserSettingUpsert) Validate() error {
}
}
if invalid {
return fmt.Errorf("invalid user setting locale value")
return errors.New("invalid user setting locale value")
}
} else {
return fmt.Errorf("invalid user setting key")
return errors.New("invalid user setting key")
}
return nil

View File

@ -1,10 +1,11 @@
package v1
import (
"github.com/labstack/echo/v4"
"github.com/boojack/slash/server/profile"
"github.com/boojack/slash/server/service/license"
"github.com/boojack/slash/store"
"github.com/labstack/echo/v4"
)
type APIV1Service struct {

View File

@ -4,10 +4,11 @@ import (
"fmt"
"net/http"
"github.com/labstack/echo/v4"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/server/profile"
"github.com/boojack/slash/store"
"github.com/labstack/echo/v4"
)
type WorkspaceProfile struct {