Skip to content

Commit

Permalink
feat(imports): use goimports from golangci-lint (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
allisson authored Nov 20, 2021
1 parent 01ce8f6 commit 6643210
Show file tree
Hide file tree
Showing 33 changed files with 725 additions and 130 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/postmand
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ PLATFORM := $(shell uname | tr A-Z a-z)
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 Expand Up @@ -33,6 +33,6 @@ run-worker:
go run cmd/postmand/main.go worker

swag-init:
swag init -g cmd/postmand/main.go --parseDependency
swag init -g cmd/postmand/main.go --parseDependency --parseDepth 2

.PHONY: lint test mock download-golang-migrate-binary db-migrate db-test-migrate run-server run-worker swag-init
11 changes: 6 additions & 5 deletions cmd/postmand/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ import (
"time"

"github.com/allisson/go-env"
_ "github.com/allisson/postmand/docs"
"github.com/allisson/postmand/http"
"github.com/allisson/postmand/http/handler"
"github.com/allisson/postmand/repository"
"github.com/allisson/postmand/service"
"github.com/go-chi/chi/v5"
"github.com/jmoiron/sqlx"
_ "github.com/joho/godotenv/autoload"
httpSwagger "github.com/swaggo/http-swagger"
"github.com/urfave/cli/v2"
"go.uber.org/zap"

_ "github.com/allisson/postmand/docs"
"github.com/allisson/postmand/http"
"github.com/allisson/postmand/http/handler"
"github.com/allisson/postmand/repository"
"github.com/allisson/postmand/service"
)

func healthcheckServer(db *sqlx.DB, logger *zap.Logger) {
Expand Down
2 changes: 1 addition & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,5 +836,5 @@ func (s *s) ReadDoc() string {
}

func init() {
swag.Register(swag.Name, &s{})
swag.Register("swagger", &s{})
}
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ go 1.17
require (
github.com/DATA-DOG/go-txdb v0.1.4
github.com/allisson/go-env v0.3.0
github.com/go-chi/chi/v5 v5.0.4
github.com/go-chi/chi/v5 v5.0.7
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/google/uuid v1.3.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/jpillora/backoff v1.0.0
github.com/lib/pq v1.10.3
github.com/lib/pq v1.10.4
github.com/steinfletcher/apitest v1.5.11
github.com/stretchr/testify v1.7.0
github.com/swaggo/http-swagger v1.1.1
github.com/swaggo/swag v1.7.3
github.com/swaggo/http-swagger v1.1.2
github.com/swaggo/swag v1.7.4
github.com/unrolled/secure v1.0.9
github.com/urfave/cli/v2 v2.3.0
go.uber.org/zap v1.19.1
Expand All @@ -28,7 +28,7 @@ require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // 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/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
Expand All @@ -46,9 +46,9 @@ require (
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/net v0.0.0-20211013171255-e13a2654a71e // indirect
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.5 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
Expand Down
711 changes: 637 additions & 74 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion http/handler/delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package handler
import (
"net/http"

"github.com/allisson/postmand"
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
"go.uber.org/zap"

"github.com/allisson/postmand"
)

type deliveryList struct {
Expand Down
3 changes: 2 additions & 1 deletion http/handler/delivery_attempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package handler
import (
"net/http"

"github.com/allisson/postmand"
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
"go.uber.org/zap"

"github.com/allisson/postmand"
)

type deliveryAttemptList struct {
Expand Down
7 changes: 4 additions & 3 deletions http/handler/delivery_attempt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
nethttp "net/http"
"testing"

"github.com/allisson/postmand"
"github.com/allisson/postmand/http"
"github.com/allisson/postmand/mocks"
"github.com/google/uuid"
"github.com/steinfletcher/apitest"
"github.com/stretchr/testify/mock"
"go.uber.org/zap"

"github.com/allisson/postmand"
"github.com/allisson/postmand/http"
"github.com/allisson/postmand/mocks"
)

func makeDeliveryAttempt() postmand.DeliveryAttempt {
Expand Down
7 changes: 4 additions & 3 deletions http/handler/delivery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
nethttp "net/http"
"testing"

"github.com/allisson/postmand"
"github.com/allisson/postmand/http"
"github.com/allisson/postmand/mocks"
"github.com/google/uuid"
"github.com/steinfletcher/apitest"
"github.com/stretchr/testify/mock"
"go.uber.org/zap"

"github.com/allisson/postmand"
"github.com/allisson/postmand/http"
"github.com/allisson/postmand/mocks"
)

func makeDelivery() postmand.Delivery {
Expand Down
3 changes: 2 additions & 1 deletion http/handler/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package handler
import (
"net/http"

"github.com/allisson/postmand"
"go.uber.org/zap"

"github.com/allisson/postmand"
)

type pingResponse struct {
Expand Down
5 changes: 3 additions & 2 deletions http/handler/ping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
nethttp "net/http"
"testing"

"github.com/allisson/postmand/http"
"github.com/allisson/postmand/mocks"
"github.com/steinfletcher/apitest"
"github.com/stretchr/testify/mock"
"go.uber.org/zap"

"github.com/allisson/postmand/http"
"github.com/allisson/postmand/mocks"
)

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

"github.com/allisson/postmand"
validation "github.com/go-ozzo/ozzo-validation/v4"
"go.uber.org/zap"

"github.com/allisson/postmand"
)

type requestFilters struct {
Expand Down
3 changes: 2 additions & 1 deletion http/handler/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package handler
import (
"net/http"

"github.com/allisson/postmand"
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
"go.uber.org/zap"

"github.com/allisson/postmand"
)

type webhookList struct {
Expand Down
7 changes: 4 additions & 3 deletions http/handler/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (
nethttp "net/http"
"testing"

"github.com/allisson/postmand"
"github.com/allisson/postmand/http"
"github.com/allisson/postmand/mocks"
"github.com/google/uuid"
"github.com/lib/pq"
"github.com/steinfletcher/apitest"
"github.com/stretchr/testify/mock"
"go.uber.org/zap"

"github.com/allisson/postmand"
"github.com/allisson/postmand/http"
"github.com/allisson/postmand/mocks"
)

func makeWebhook() postmand.Webhook {
Expand Down
3 changes: 2 additions & 1 deletion http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"os/signal"
"syscall"

mw "github.com/allisson/postmand/http/middleware"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"go.uber.org/zap"

mw "github.com/allisson/postmand/http/middleware"
)

// NewRouter returns *chi.Mux with base middlewares.
Expand Down
3 changes: 2 additions & 1 deletion repository/delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (
"net/http/httputil"
"time"

"github.com/allisson/postmand"
"github.com/google/uuid"
"github.com/jmoiron/sqlx"
"github.com/jpillora/backoff"

"github.com/allisson/postmand"
)

type dispatchResponse struct {
Expand Down
3 changes: 2 additions & 1 deletion repository/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/postmand"
"github.com/jmoiron/sqlx"

"github.com/allisson/postmand"
)

// DeliveryAttempt implements postmand.DeliveryAttemptRepository interface.
Expand Down
3 changes: 2 additions & 1 deletion repository/delivery_attempt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"testing"
"time"

"github.com/allisson/postmand"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"

"github.com/allisson/postmand"
)

func makeDeliveryAttempt() postmand.DeliveryAttempt {
Expand Down
3 changes: 2 additions & 1 deletion repository/delivery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"testing"
"time"

"github.com/allisson/postmand"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"

"github.com/allisson/postmand"
)

func makeDelivery() postmand.Delivery {
Expand Down
3 changes: 2 additions & 1 deletion repository/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"log"
"strings"

"github.com/allisson/postmand"
"github.com/huandu/go-sqlbuilder"
"github.com/jmoiron/sqlx"

"github.com/allisson/postmand"
)

func getQuery(tableName string, getOptions postmand.RepositoryGetOptions) (string, []interface{}) {
Expand Down
3 changes: 2 additions & 1 deletion repository/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"database/sql"

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

"github.com/allisson/postmand"
)

// Webhook implements postmand.WebhookRepository interface.
Expand Down
3 changes: 2 additions & 1 deletion repository/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"testing"
"time"

"github.com/allisson/postmand"
"github.com/google/uuid"
"github.com/lib/pq"
"github.com/stretchr/testify/assert"

"github.com/allisson/postmand"
)

func makeWebhook() postmand.Webhook {
Expand Down
3 changes: 2 additions & 1 deletion service/delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"context"
"time"

"github.com/allisson/postmand"
"github.com/google/uuid"

"github.com/allisson/postmand"
)

// Delivery implements postmand.DeliveryService interface.
Expand Down
5 changes: 3 additions & 2 deletions service/delivery_attempt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"testing"

"github.com/allisson/postmand"
"github.com/allisson/postmand/mocks"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

"github.com/allisson/postmand"
"github.com/allisson/postmand/mocks"
)

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

"github.com/allisson/postmand"
"github.com/allisson/postmand/mocks"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

"github.com/allisson/postmand"
"github.com/allisson/postmand/mocks"
)

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

"github.com/allisson/postmand"
"go.uber.org/zap"

"github.com/allisson/postmand"
)

// Migration implements postmand.MigrationService interface.
Expand Down
3 changes: 2 additions & 1 deletion service/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"testing"

"github.com/allisson/postmand/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"go.uber.org/zap"

"github.com/allisson/postmand/mocks"
)

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

0 comments on commit 6643210

Please sign in to comment.