From 09e4e612bb66ba470f22f99fde50fa49a5a53089 Mon Sep 17 00:00:00 2001 From: gllm-dev Date: Wed, 27 Mar 2024 17:41:14 +0100 Subject: [PATCH] fix: linter --- .golangci.yml | 1 - internal/applications/userapp/app.go | 2 +- internal/core/services/projectsvc/svc_test.go | 2 +- internal/core/services/sharesvc/svc_test.go | 3 ++- internal/core/services/usersvc/svc_test.go | 5 ++--- internal/infrastructure/handlers/rest/server.go | 2 +- .../infrastructure/handlers/rest/userhdl/handler.go | 1 - .../repositories/mocks/projectmockrepo/repo.go | 1 + .../repositories/mocks/usermockedrepo/repo.go | 13 +++++++------ 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index bc7da8e..03aa678 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,7 +6,6 @@ linters: - errcheck - errorlint - exportloopref - - funlen - gocheckcompilerdirectives - gochecknoinits - goconst diff --git a/internal/applications/userapp/app.go b/internal/applications/userapp/app.go index f6b1b49..23830f4 100644 --- a/internal/applications/userapp/app.go +++ b/internal/applications/userapp/app.go @@ -2,10 +2,10 @@ package userapp import ( "context" - "go.openfort.xyz/shield/internal/core/domain/share" "log/slog" "os" + "go.openfort.xyz/shield/internal/core/domain/share" "go.openfort.xyz/shield/internal/core/ports/services" "go.openfort.xyz/shield/internal/infrastructure/providersmgr" "go.openfort.xyz/shield/pkg/ofcontext" diff --git a/internal/core/services/projectsvc/svc_test.go b/internal/core/services/projectsvc/svc_test.go index 2387c3d..ce31e73 100644 --- a/internal/core/services/projectsvc/svc_test.go +++ b/internal/core/services/projectsvc/svc_test.go @@ -3,10 +3,10 @@ package projectsvc import ( "context" "errors" - "go.openfort.xyz/shield/internal/core/domain/project" "testing" "github.com/stretchr/testify/mock" + "go.openfort.xyz/shield/internal/core/domain/project" "go.openfort.xyz/shield/internal/infrastructure/repositories/mocks/projectmockrepo" ) diff --git a/internal/core/services/sharesvc/svc_test.go b/internal/core/services/sharesvc/svc_test.go index 079b1b1..abe825f 100644 --- a/internal/core/services/sharesvc/svc_test.go +++ b/internal/core/services/sharesvc/svc_test.go @@ -3,11 +3,12 @@ package sharesvc import ( "context" "errors" + "testing" + "github.com/stretchr/testify/mock" "go.openfort.xyz/shield/internal/core/domain" "go.openfort.xyz/shield/internal/core/domain/share" "go.openfort.xyz/shield/internal/infrastructure/repositories/mocks/sharemockrepo" - "testing" ) func TestCreateShare(t *testing.T) { diff --git a/internal/core/services/usersvc/svc_test.go b/internal/core/services/usersvc/svc_test.go index 2fe691b..de4145e 100644 --- a/internal/core/services/usersvc/svc_test.go +++ b/internal/core/services/usersvc/svc_test.go @@ -3,11 +3,12 @@ package usersvc import ( "context" "errors" + "testing" + "github.com/stretchr/testify/mock" "go.openfort.xyz/shield/internal/core/domain" "go.openfort.xyz/shield/internal/core/domain/user" "go.openfort.xyz/shield/internal/infrastructure/repositories/mocks/usermockedrepo" - "testing" ) func TestCreateUser(t *testing.T) { @@ -47,7 +48,6 @@ func TestCreateUser(t *testing.T) { return } }) - } } @@ -102,7 +102,6 @@ func TestGetUser(t *testing.T) { return } }) - } } diff --git a/internal/infrastructure/handlers/rest/server.go b/internal/infrastructure/handlers/rest/server.go index 8f55e24..de9b154 100644 --- a/internal/infrastructure/handlers/rest/server.go +++ b/internal/infrastructure/handlers/rest/server.go @@ -3,12 +3,12 @@ package rest import ( "context" "fmt" - "github.com/rs/cors" "log/slog" "net/http" "os" "github.com/gorilla/mux" + "github.com/rs/cors" "go.openfort.xyz/shield/internal/applications/projectapp" "go.openfort.xyz/shield/internal/applications/userapp" "go.openfort.xyz/shield/internal/infrastructure/authenticationmgr" diff --git a/internal/infrastructure/handlers/rest/userhdl/handler.go b/internal/infrastructure/handlers/rest/userhdl/handler.go index 5db5cc3..6d844b9 100644 --- a/internal/infrastructure/handlers/rest/userhdl/handler.go +++ b/internal/infrastructure/handlers/rest/userhdl/handler.go @@ -71,7 +71,6 @@ func (h *Handler) RegisterShare(w http.ResponseWriter, r *http.Request) { Length: req.Length, Digest: req.Digest, } - } err = h.app.RegisterShare(ctx, req.Secret, req.UserEntropy, parameters) diff --git a/internal/infrastructure/repositories/mocks/projectmockrepo/repo.go b/internal/infrastructure/repositories/mocks/projectmockrepo/repo.go index df52438..0f74c9e 100644 --- a/internal/infrastructure/repositories/mocks/projectmockrepo/repo.go +++ b/internal/infrastructure/repositories/mocks/projectmockrepo/repo.go @@ -2,6 +2,7 @@ package projectmockrepo import ( "context" + "github.com/stretchr/testify/mock" "go.openfort.xyz/shield/internal/core/domain/project" "go.openfort.xyz/shield/internal/core/ports/repositories" diff --git a/internal/infrastructure/repositories/mocks/usermockedrepo/repo.go b/internal/infrastructure/repositories/mocks/usermockedrepo/repo.go index 5d64a3e..d23012e 100644 --- a/internal/infrastructure/repositories/mocks/usermockedrepo/repo.go +++ b/internal/infrastructure/repositories/mocks/usermockedrepo/repo.go @@ -2,6 +2,7 @@ package usermockedrepo import ( "context" + "github.com/stretchr/testify/mock" "go.openfort.xyz/shield/internal/core/domain/user" "go.openfort.xyz/shield/internal/core/ports/repositories" @@ -13,16 +14,16 @@ type MockUserRepository struct { var _ repositories.Options = (*MockUserRepository)(nil) -func (m *MockUserRepository) WithUserID(userID string) repositories.Option { - return func(opts repositories.Options) {} +func (m *MockUserRepository) WithUserID(_ string) repositories.Option { + return func(_ repositories.Options) {} } -func (m *MockUserRepository) WithExternalUserID(externalUserID string) repositories.Option { - return func(opts repositories.Options) {} +func (m *MockUserRepository) WithExternalUserID(_ string) repositories.Option { + return func(_ repositories.Options) {} } -func (m *MockUserRepository) WithProviderID(providerID string) repositories.Option { - return func(opts repositories.Options) {} +func (m *MockUserRepository) WithProviderID(_ string) repositories.Option { + return func(_ repositories.Options) {} } var _ repositories.UserRepository = (*MockUserRepository)(nil)