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

@ -5,9 +5,10 @@ import (
"io/fs"
"net/http"
"github.com/boojack/slash/internal/util"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/boojack/slash/internal/util"
)
//go:embed dist

View File

@ -7,8 +7,10 @@ import (
"runtime"
"strings"
"github.com/boojack/slash/server/version"
"github.com/pkg/errors"
"github.com/spf13/viper"
"github.com/boojack/slash/server/version"
)
// Profile is the configuration to start main server.
@ -44,7 +46,7 @@ func checkDSN(dataDir string) (string, error) {
dataDir = strings.TrimRight(dataDir, "\\/")
if _, err := os.Stat(dataDir); err != nil {
return "", fmt.Errorf("unable to access data folder %s, err %w", dataDir, err)
return "", errors.Wrapf(err, "unable to access data folder %s", dataDir)
}
return dataDir, nil

View File

@ -6,11 +6,12 @@ import (
"net/http"
"os"
"github.com/h2non/filetype"
"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/h2non/filetype"
"github.com/labstack/echo/v4"
)
type ResourceService struct {

View File

@ -8,15 +8,17 @@ import (
"strings"
"time"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/pkg/errors"
apiv1 "github.com/boojack/slash/api/v1"
apiv2 "github.com/boojack/slash/api/v2"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/server/profile"
"github.com/boojack/slash/server/service/license"
"github.com/boojack/slash/store"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
type Server struct {
@ -102,7 +104,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
s.apiV2Service = apiv2.NewAPIV2Service(secret, profile, store, licenseService, s.Profile.Port+1)
// Register gRPC gateway as api v2.
if err := s.apiV2Service.RegisterGateway(ctx, e); err != nil {
return nil, fmt.Errorf("failed to register gRPC gateway: %w", err)
return nil, errors.Wrap(err, "failed to register gRPC gateway")
}
// Register resource service.

View File

@ -4,12 +4,13 @@ import (
"context"
"time"
"github.com/pkg/errors"
"google.golang.org/protobuf/types/known/timestamppb"
apiv2pb "github.com/boojack/slash/proto/gen/api/v2"
storepb "github.com/boojack/slash/proto/gen/store"
"github.com/boojack/slash/server/profile"
"github.com/boojack/slash/store"
"github.com/pkg/errors"
"google.golang.org/protobuf/types/known/timestamppb"
)
type LicenseService struct {