Skip to content

Commit

Permalink
ci: enable recent gci linter options and fix reported errors (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoVeille authored Jul 7, 2024
1 parent 80673fe commit cd6a321
Show file tree
Hide file tree
Showing 29 changed files with 37 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ linters-settings:
statements: 50
gci:
sections:
- prefix(gofr.dev)
- standard
- default
- localmodule
goconst:
min-len: 2
min-occurrences: 2
Expand Down
5 changes: 3 additions & 2 deletions examples/grpc-server/grpc/hello.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/grpc-server/grpc/hello_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/using-file-bind/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package main

import (
"bytes"
"github.com/stretchr/testify/assert"
"io"
"mime/multipart"
"net/http"
"os"
"testing"
"time"

"github.com/stretchr/testify/assert"
)

func TestMain_BindError(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion examples/using-migrations/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"

"gofr.dev/examples/using-migrations/migrations"

"gofr.dev/pkg/gofr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"

"gofr.dev/pkg/gofr/migration"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package migrations

import (
"context"

"gofr.dev/pkg/gofr/migration"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/go-redis/redismock/v9"
"github.com/stretchr/testify/assert"

"gofr.dev/pkg/gofr/migration"
)

Expand Down
1 change: 1 addition & 0 deletions examples/using-publisher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"

"gofr.dev/pkg/gofr"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

_ "github.com/go-sql-driver/mysql" // This is required to be blank import

"gofr.dev/pkg/gofr/config"
"gofr.dev/pkg/gofr/datasource"
"gofr.dev/pkg/gofr/datasource/file"
Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/container/mock_datasources.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pkg/gofr/datasource/clickhouse/clickhouse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import (
"testing"
"time"

"go.uber.org/mock/gomock"

"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)

func getClickHouseTestConnection(t *testing.T) (*MockConn, *MockMetrics, client) {
Expand Down
1 change: 0 additions & 1 deletion pkg/gofr/datasource/mongo/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mongo
import (
"context"
"fmt"

"testing"

"github.com/stretchr/testify/assert"
Expand Down
3 changes: 2 additions & 1 deletion pkg/gofr/datasource/pubsub/google/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"errors"
"time"

"gofr.dev/pkg/gofr/datasource"
"google.golang.org/api/iterator"

"gofr.dev/pkg/gofr/datasource"
)

func (g *googleClient) Health() (health datasource.Health) {
Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/datasource/pubsub/mqtt/mock_interfaces.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/gofr/datasource/redis/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"strings"
"time"

"gofr.dev/pkg/gofr/datasource"

"github.com/redis/go-redis/v9"

"gofr.dev/pkg/gofr/datasource"
)

// redisHook is a custom Redis hook for logging queries and their durations.
Expand Down
1 change: 0 additions & 1 deletion pkg/gofr/datasource/redis/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/alicebob/miniredis/v2"
"github.com/stretchr/testify/assert"

"go.uber.org/mock/gomock"

"gofr.dev/pkg/gofr/config"
Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"go.opentelemetry.io/otel/attribute"
sdktrace "go.opentelemetry.io/otel/sdk/trace"

"gofr.dev/pkg/gofr/logging"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/gofr/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (

grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
grpc2 "gofr.dev/pkg/gofr/grpc"
"google.golang.org/grpc"

"gofr.dev/pkg/gofr/container"
grpc2 "gofr.dev/pkg/gofr/grpc"
)

type grpcServer struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/http/middleware/basic_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"

"gofr.dev/pkg/gofr/container"
)

Expand Down
7 changes: 3 additions & 4 deletions pkg/gofr/http/middleware/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package middleware

import (
"context"

"github.com/gorilla/mux"
"github.com/stretchr/testify/mock"

"net/http"
"net/http/httptest"
"testing"

"github.com/gorilla/mux"
"github.com/stretchr/testify/mock"
)

type mockMetrics struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/gofr/http/middleware/web_socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"net/http"

gorillaWebsocket "github.com/gorilla/websocket"

"gofr.dev/pkg/gofr/container"
"gofr.dev/pkg/gofr/websocket"

gorillaWebsocket "github.com/gorilla/websocket"
)

// WSHandlerUpgrade middleware upgrades the incoming http request to a websocket connection using websocket upgrader.
Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/http/middleware/web_socket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/gorilla/websocket"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"

"gofr.dev/pkg/gofr/container"
gofrWebSocket "gofr.dev/pkg/gofr/websocket"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/logging/remotelogger/dynamicLevelLogger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/stretchr/testify/assert"

"gofr.dev/pkg/gofr/logging"
"gofr.dev/pkg/gofr/service"
"gofr.dev/pkg/gofr/testutil"
Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/migration/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

goRedis "github.com/redis/go-redis/v9"

"gofr.dev/pkg/gofr/container"
)

Expand Down
1 change: 1 addition & 0 deletions pkg/gofr/migration/mock_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/gofr/service/circuit_breaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"go.opentelemetry.io/otel"

"gofr.dev/pkg/gofr/logging"
"gofr.dev/pkg/gofr/testutil"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/gofr/service/retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/http/httptest"
"testing"

"gofr.dev/pkg/gofr/logging"

"github.com/stretchr/testify/assert"

"gofr.dev/pkg/gofr/logging"
)

type mockHTTP struct{}
Expand Down
3 changes: 1 addition & 2 deletions pkg/gofr/websocket/websocket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (
"testing"
"time"

"go.uber.org/mock/gomock"

"github.com/gorilla/websocket"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)

func TestConnection_Bind_Success(t *testing.T) {
Expand Down

0 comments on commit cd6a321

Please sign in to comment.