Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up formatting imports using goimports-reviser #384

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.DEFAULT_GOAL := help
.PHONY : check lint install-linters dep test
.PHONY : build clean install format bin
.PHONY : host-apps bin
.PHONY : check lint install-linters dep test
.PHONY : build clean install format bin
.PHONY : host-apps bin
.PHONY : run stop config
.PHONY : docker-image docker-clean docker-network
.PHONY : docker-apps docker-bin docker-volume
.PHONY : docker-run docker-stop
.PHONY : docker-image docker-clean docker-network
.PHONY : docker-apps docker-bin docker-volume
.PHONY : docker-run docker-stop

VERSION := $(shell git describe)

Expand Down Expand Up @@ -113,15 +113,17 @@ install-linters: ## Install linters
# However, they suggest `curl ... | bash` which we should not do
# ${OPTS} go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
${OPTS} go get -u golang.org/x/tools/cmd/goimports
${OPTS} go get -u github.com/incu6us/goimports-reviser

tidy: ## Tidies and vendors dependencies.
${OPTS} go mod tidy -v
${OPTS} go mod vendor -v

format: tidy ## Formats the code. Must have goimports installed (use make install-linters).
format: tidy ## Formats the code. Must have goimports and goimports-reviser installed (use make install-linters).
${OPTS} goimports -w -local ${PROJECT_BASE} ./pkg
${OPTS} goimports -w -local ${PROJECT_BASE} ./cmd
${OPTS} goimports -w -local ${PROJECT_BASE} ./internal
find . -type f -name '*.go' -not -path "./vendor/*" -exec goimports-reviser -project-name ${PROJECT_BASE} -file-path {} \;

dep: ## Sorts dependencies
${OPTS} go mod vendor -v
Expand Down
3 changes: 1 addition & 2 deletions cmd/skywire-cli/commands/mdisc/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (
"text/tabwriter"
"time"

"github.com/SkycoinProject/skywire-mainnet/pkg/skyenv"

"github.com/SkycoinProject/dmsg/disc"
"github.com/spf13/cobra"

"github.com/SkycoinProject/skywire-mainnet/cmd/skywire-cli/internal"
"github.com/SkycoinProject/skywire-mainnet/pkg/skyenv"
)

var mdAddr string
Expand Down
7 changes: 3 additions & 4 deletions cmd/skywire-cli/commands/rtfind/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import (
"fmt"
"time"

"github.com/SkycoinProject/skywire-mainnet/pkg/routefinder/rfclient"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/skyenv"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/spf13/cobra"
"golang.org/x/net/context"

"github.com/SkycoinProject/skywire-mainnet/cmd/skywire-cli/internal"
"github.com/SkycoinProject/skywire-mainnet/pkg/routefinder/rfclient"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/skyenv"
)

var frAddr string
Expand Down
5 changes: 2 additions & 3 deletions cmd/skywire-cli/commands/visor/gen-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import (
"os"
"path/filepath"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"

"github.com/SkycoinProject/skywire-mainnet/pkg/visor/visorconfig"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/spf13/cobra"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-visor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"
"io/ioutil"
"net/http"
_ "net/http/pprof" //nolint:gosec // https://golang.org/doc/diagnostics.html#profiling
_ "net/http/pprof" // nolint:gosec // https://golang.org/doc/diagnostics.html#profiling
"os"

"github.com/SkycoinProject/dmsg/buildinfo"
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/appevent/mock_rpc_client.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/app/appserver/mock_proc_manager.go

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

5 changes: 2 additions & 3 deletions pkg/app/appserver/mock_rpc_ingress_client.go

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

6 changes: 2 additions & 4 deletions pkg/app/appserver/rpc_ingress_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ import (
"testing"
"time"

"github.com/SkycoinProject/skywire-mainnet/internal/testhelpers"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"golang.org/x/net/nettest"

"github.com/SkycoinProject/skywire-mainnet/internal/testhelpers"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appcommon"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appnet"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"

"github.com/SkycoinProject/skywire-mainnet/pkg/app/appcommon"
)

func TestRPCClient_Dial(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/hypervisor/user_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import (
"sync"
"time"

"github.com/SkycoinProject/dmsg/httputil"
"github.com/google/uuid"
"github.com/gorilla/securecookie"

"github.com/SkycoinProject/dmsg/httputil"
)

const (
Expand Down
1 change: 0 additions & 1 deletion pkg/router/mock_router.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/router/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import (
"testing"
"time"

"github.com/sirupsen/logrus"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/google/uuid"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
4 changes: 2 additions & 2 deletions pkg/setup/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package setup
import (
"time"

"github.com/SkycoinProject/skywire-mainnet/pkg/snet"

"github.com/SkycoinProject/dmsg/cipher"

"github.com/SkycoinProject/skywire-mainnet/pkg/snet"
)

//go:generate readmegen -n Config -o ./README.md ./config.go
Expand Down
9 changes: 3 additions & 6 deletions pkg/setup/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,20 @@ import (
"testing"
"time"

"github.com/SkycoinProject/skywire-mainnet/pkg/setup/setupclient"

"github.com/SkycoinProject/skywire-mainnet/internal/testhelpers"

"github.com/SkycoinProject/skywire-mainnet/pkg/snet/snettest"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/google/uuid"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

"github.com/SkycoinProject/skywire-mainnet/internal/testhelpers"
"github.com/SkycoinProject/skywire-mainnet/pkg/metrics"
"github.com/SkycoinProject/skywire-mainnet/pkg/router"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/setup/setupclient"
"github.com/SkycoinProject/skywire-mainnet/pkg/skyenv"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet/snettest"
)

func TestMain(m *testing.M) {
Expand Down
10 changes: 5 additions & 5 deletions pkg/snet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
"sync"
"time"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/dmsg/disc"
"github.com/SkycoinProject/skycoin/src/util/logging"

"github.com/SkycoinProject/skywire-mainnet/pkg/app/appevent"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet/arclient"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet/stcp"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet/stcph"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet/stcpr"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/dmsg/disc"
"github.com/SkycoinProject/skycoin/src/util/logging"
)

var log = logging.MustGetLogger("snet")
Expand Down
3 changes: 1 addition & 2 deletions pkg/snet/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package snet
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
"github.com/stretchr/testify/require"
)

func TestDisassembleAddr(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions pkg/snet/stcp/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (
"net"
"time"

cipher2 "github.com/SkycoinProject/skycoin/src/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
cipher2 "github.com/SkycoinProject/skycoin/src/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
)

var log = logging.MustGetLogger("stcp")
Expand Down
5 changes: 2 additions & 3 deletions pkg/snet/stcph/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (
"net"
"time"

cipher2 "github.com/SkycoinProject/skycoin/src/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
cipher2 "github.com/SkycoinProject/skycoin/src/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
)

var log = logging.MustGetLogger("stcph")
Expand Down
5 changes: 2 additions & 3 deletions pkg/snet/stcpr/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (
"net"
"time"

cipher2 "github.com/SkycoinProject/skycoin/src/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
cipher2 "github.com/SkycoinProject/skycoin/src/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
)

var log = logging.MustGetLogger("stcpr")
Expand Down
3 changes: 1 addition & 2 deletions pkg/transport/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/stretchr/testify/require"

"github.com/SkycoinProject/skywire-mainnet/pkg/transport"
)
Expand Down
3 changes: 1 addition & 2 deletions pkg/transport/entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/stretchr/testify/assert"

"github.com/SkycoinProject/skywire-mainnet/pkg/transport"
)
Expand Down
8 changes: 4 additions & 4 deletions pkg/transport/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"sync"
"time"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/google/uuid"

"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/skyenv"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet/snettest"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/google/uuid"
)

// ManagerConfig configures a Manager.
Expand Down
9 changes: 4 additions & 5 deletions pkg/transport/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ import (
"testing"
"time"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet/snettest"
"github.com/SkycoinProject/skywire-mainnet/pkg/transport"

"github.com/SkycoinProject/dmsg"
"github.com/SkycoinProject/dmsg/cipher"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

var masterLogger *logging.MasterLogger
Expand Down
7 changes: 3 additions & 4 deletions pkg/visor/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import (
"testing"
"time"

"github.com/SkycoinProject/skywire-mainnet/pkg/visor/visorconfig"

"github.com/SkycoinProject/skywire-mainnet/pkg/transport"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/SkycoinProject/skywire-mainnet/pkg/transport"
"github.com/SkycoinProject/skywire-mainnet/pkg/visor/visorconfig"
)

func baseConfig(t *testing.T) *visorconfig.V1 {
Expand Down
Loading