Skip to content

Commit

Permalink
feat(imports): use goimports from golangci-lint (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
allisson authored Nov 20, 2021
1 parent f7c9fb2 commit 031344a
Show file tree
Hide file tree
Showing 35 changed files with 694 additions and 137 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ linters:
- rowserrcheck
- sqlclosecheck
- ifshort
- goimports
linters-settings:
goimports:
local-prefixes: github.com/allisson/hammer
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ build-protobuf:
lint:
if [ ! -f ./bin/golangci-lint ] ; \
then \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.42.1; \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.43.0; \
fi;
./bin/golangci-lint run
./bin/golangci-lint run --fix

test:
go test -covermode=count -coverprofile=count.out -v ./...
Expand Down
11 changes: 6 additions & 5 deletions cmd/hammer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import (
"time"

"github.com/allisson/go-env"
"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
hammerGrpc "github.com/allisson/hammer/grpc"
repository "github.com/allisson/hammer/repository/postgres"
"github.com/allisson/hammer/service"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
Expand All @@ -30,6 +25,12 @@ import (
"github.com/urfave/cli/v2"
"go.uber.org/zap"
"google.golang.org/grpc"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
hammerGrpc "github.com/allisson/hammer/grpc"
repository "github.com/allisson/hammer/repository/postgres"
"github.com/allisson/hammer/service"
)

var (
Expand Down
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ require (
github.com/DATA-DOG/go-txdb v0.1.4
github.com/allisson/go-env v0.3.0
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
github.com/golang-migrate/migrate/v4 v4.15.0
github.com/golang-migrate/migrate/v4 v4.15.1
github.com/golang/protobuf v1.5.2
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/huandu/go-sqlbuilder v1.13.0
github.com/jmoiron/sqlx v1.3.4
github.com/joho/godotenv v1.4.0
github.com/lib/pq v1.10.3
github.com/lib/pq v1.10.4
github.com/oklog/ulid/v2 v2.0.2
github.com/prometheus/client_golang v1.11.0
github.com/stretchr/testify v1.7.0
github.com/urfave/cli/v2 v2.3.0
go.uber.org/zap v1.19.1
golang.org/x/net v0.0.0-20210929193557-e81a3d93ecf6
google.golang.org/genproto v0.0.0-20211001223012-bfb93cce50d9
google.golang.org/grpc v1.41.0
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1
google.golang.org/grpc v1.42.0
google.golang.org/protobuf v1.27.1
)

require (
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
Expand All @@ -45,7 +45,7 @@ require (
github.com/stretchr/objx v0.2.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
664 changes: 593 additions & 71 deletions go.sum

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions grpc/delivery_attempt_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"database/sql"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
)

// DeliveryAttemptHandler implements methods for DeliveryAttempt get/list
Expand Down
7 changes: 4 additions & 3 deletions grpc/delivery_attempt_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"testing"
"time"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"golang.org/x/net/context"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
)

func TestDeliveryAttemptHandler(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions grpc/delivery_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"database/sql"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
)

// DeliveryHandler implements methods for Delivery get/list
Expand Down
7 changes: 4 additions & 3 deletions grpc/delivery_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"testing"
"time"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"golang.org/x/net/context"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
)

func TestDeliveryHandler(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions grpc/message_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"
"database/sql"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
)

// MessageHandler implements methods for message create/update
Expand Down
7 changes: 4 additions & 3 deletions grpc/message_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"testing"
"time"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
"github.com/golang/protobuf/ptypes/empty"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"golang.org/x/net/context"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
)

func TestMessageHandler(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package grpc
import (
"context"

pb "github.com/allisson/hammer/api/v1"
"github.com/golang/protobuf/ptypes/empty"

pb "github.com/allisson/hammer/api/v1"
)

// Server implements grpc server
Expand Down
5 changes: 3 additions & 2 deletions grpc/subscription_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"
"database/sql"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
)

// SubscriptionHandler implements methods for topic create/update
Expand Down
7 changes: 4 additions & 3 deletions grpc/subscription_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package grpc
import (
"testing"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
"github.com/golang/protobuf/ptypes/empty"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"golang.org/x/net/context"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
)

func TestSubscriptionHandler(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions grpc/topic_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"
"database/sql"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
)

// TopicHandler implements methods for topic create/update
Expand Down
7 changes: 4 additions & 3 deletions grpc/topic_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package grpc
import (
"testing"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
"github.com/golang/protobuf/ptypes/empty"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"golang.org/x/net/context"

"github.com/allisson/hammer"
pb "github.com/allisson/hammer/api/v1"
"github.com/allisson/hammer/mocks"
)

func TestTopicHandler(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
"net/http/httputil"
"time"

"github.com/allisson/hammer"
"github.com/jmoiron/sqlx"

"github.com/allisson/hammer"
)

type dispatchResponse struct {
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/delivery_attempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"database/sql"

"github.com/allisson/hammer"
"github.com/jmoiron/sqlx"

"github.com/allisson/hammer"
)

// DeliveryAttempt is a implementation of hammer.DeliveryAttemptRepository
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/delivery_attempt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"testing"

"github.com/allisson/hammer"
"github.com/stretchr/testify/assert"

"github.com/allisson/hammer"
)

func TestDeliveryAttempt(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/delivery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"net/http/httptest"
"testing"

"github.com/allisson/hammer"
"github.com/stretchr/testify/assert"

"github.com/allisson/hammer"
)

func TestDispatchToURL(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (

"github.com/DATA-DOG/go-txdb"
"github.com/allisson/go-env"
"github.com/allisson/hammer"
"github.com/huandu/go-sqlbuilder"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
"go.uber.org/zap"

"github.com/allisson/hammer"
)

func init() {
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"database/sql"
"time"

"github.com/allisson/hammer"
"github.com/jmoiron/sqlx"

"github.com/allisson/hammer"
)

// Message is a implementation of hammer.MessageRepository
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"testing"

"github.com/allisson/hammer"
"github.com/stretchr/testify/assert"

"github.com/allisson/hammer"
)

func TestMessage(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"database/sql"

"github.com/allisson/hammer"
"github.com/jmoiron/sqlx"

"github.com/allisson/hammer"
)

// Subscription is a implementation of hammer.SubscriptionRepository
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"testing"

"github.com/allisson/hammer"
"github.com/stretchr/testify/assert"

"github.com/allisson/hammer"
)

func TestSubscription(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"database/sql"

"github.com/allisson/hammer"
"github.com/jmoiron/sqlx"

"github.com/allisson/hammer"
)

// Topic is a implementation of hammer.TopicRepository
Expand Down
3 changes: 2 additions & 1 deletion repository/postgres/topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"testing"

"github.com/allisson/hammer"
"github.com/stretchr/testify/assert"

"github.com/allisson/hammer"
)

func TestTopic(t *testing.T) {
Expand Down
Loading

0 comments on commit 031344a

Please sign in to comment.