🚨 Removed linter warnings

This commit is contained in:
Maxim Lebedev 2022-02-02 03:01:52 +05:00
parent 3f565cb6b3
commit 5b90405d40
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
6 changed files with 21 additions and 21 deletions

View File

@ -25,7 +25,7 @@ import (
userrepo "source.toby3d.me/website/indieauth/internal/user/repository/memory"
)
type dependencies struct {
type Dependencies struct {
authService auth.UseCase
clients client.Repository
clientService client.UseCase
@ -47,7 +47,7 @@ func TestRender(t *testing.T) {
deps.store.Store(path.Join(profilerepo.DefaultPathPrefix, me.String()), user.Profile)
deps.store.Store(path.Join(userrepo.DefaultPathPrefix, me.String()), user)
r := router.New()
r := router.New() //nolint: varnamelen
delivery.NewRequestHandler(delivery.NewRequestHandlerOptions{
Auth: deps.authService,
Clients: deps.clientService,
@ -95,18 +95,18 @@ func TestRender(t *testing.T) {
}
}
func NewDependencies(tb testing.TB) dependencies {
func NewDependencies(tb testing.TB) Dependencies {
tb.Helper()
config := domain.TestConfig(tb)
matcher := language.NewMatcher(message.DefaultCatalog.Languages())
store := new(sync.Map)
clients := clientrepo.NewMemoryClientRepository(store)
sessions := sessionrepo.NewMemorySessionRepository(config, store)
sessions := sessionrepo.NewMemorySessionRepository(store, config)
authService := ucase.NewAuthUseCase(sessions, config)
clientService := clientucase.NewClientUseCase(clients)
return dependencies{
return Dependencies{
authService: authService,
clients: clients,
clientService: clientService,

View File

@ -19,7 +19,7 @@ import (
tokenucase "source.toby3d.me/website/indieauth/internal/token/usecase"
)
type dependencies struct {
type Dependencies struct {
client *domain.Client
config *domain.Config
matcher language.Matcher
@ -34,7 +34,7 @@ func TestRead(t *testing.T) {
deps := NewDependencies(t)
r := router.New()
r := router.New() //nolint: varnamelen
delivery.NewRequestHandler(delivery.NewRequestHandlerOptions{
Client: deps.client,
Config: deps.config,
@ -62,18 +62,18 @@ func TestRead(t *testing.T) {
}
}
func NewDependencies(tb testing.TB) dependencies {
func NewDependencies(tb testing.TB) Dependencies {
tb.Helper()
client := domain.TestClient(tb)
config := domain.TestConfig(tb)
matcher := language.NewMatcher(message.DefaultCatalog.Languages())
store := new(sync.Map)
sessions := sessionrepo.NewMemorySessionRepository(config, store)
sessions := sessionrepo.NewMemorySessionRepository(store, config)
tokens := tokenrepo.NewMemoryTokenRepository(store)
tokenService := tokenucase.NewTokenUseCase(tokens, sessions, config)
return dependencies{
return Dependencies{
client: client,
config: config,
matcher: matcher,

View File

@ -25,7 +25,7 @@ type (
const DefaultPathPrefix string = "sessions"
func NewMemorySessionRepository(config *domain.Config, store *sync.Map) session.Repository {
func NewMemorySessionRepository(store *sync.Map, config *domain.Config) session.Repository {
return &memorySessionRepository{
config: config,
store: store,

View File

@ -12,14 +12,14 @@ import (
func New(tb testing.TB) (*bolt.DB, func()) {
tb.Helper()
f, err := os.CreateTemp(os.TempDir(), "bbolt_*.db")
tempFile, err := os.CreateTemp(os.TempDir(), "bbolt_*.db")
if err != nil {
tb.Fatal(err)
}
filePath := f.Name()
filePath := tempFile.Name()
if err := f.Close(); err != nil {
if err := tempFile.Close(); err != nil {
tb.Fatal(err)
}

View File

@ -18,7 +18,7 @@ import (
ucase "source.toby3d.me/website/indieauth/internal/ticket/usecase"
)
type dependencies struct {
type Dependencies struct {
client *http.Client
config *domain.Config
matcher language.Matcher
@ -70,7 +70,7 @@ func TestUpdate(t *testing.T) {
}
}
func NewDependencies(tb testing.TB) dependencies {
func NewDependencies(tb testing.TB) Dependencies {
tb.Helper()
config := domain.TestConfig(tb)
@ -79,7 +79,7 @@ func NewDependencies(tb testing.TB) dependencies {
ticket := domain.TestTicket(tb)
token := domain.TestToken(tb)
r := router.New()
r := router.New() //nolint: varnamelen
// NOTE(toby3d): private resource
r.GET(ticket.Resource.URL().EscapedPath(), func(ctx *http.RequestCtx) {
ctx.SuccessString(common.MIMETextHTMLCharsetUTF8,
@ -101,7 +101,7 @@ func NewDependencies(tb testing.TB) dependencies {
tickets := ticketrepo.NewMemoryTicketRepository(store, config)
ticketService := ucase.NewTicketUseCase(tickets, client, config)
return dependencies{
return Dependencies{
client: client,
config: config,
matcher: matcher,

View File

@ -24,7 +24,7 @@ import (
tokenucase "source.toby3d.me/website/indieauth/internal/token/usecase"
)
type dependencies struct {
type Dependencies struct {
client *http.Client
config *domain.Config
sessions session.Repository
@ -131,7 +131,7 @@ func TestRevocation(t *testing.T) {
}
}
func NewDependencies(tb testing.TB) dependencies {
func NewDependencies(tb testing.TB) Dependencies {
tb.Helper()
client := new(http.Client)
@ -144,7 +144,7 @@ func NewDependencies(tb testing.TB) dependencies {
ticketService := ticketucase.NewTicketUseCase(tickets, client, config)
tokenService := tokenucase.NewTokenUseCase(tokens, sessions, config)
return dependencies{
return Dependencies{
client: client,
config: config,
sessions: sessions,