Merge pull request #375 from InsanePrawn/make_formatcheck

Add `make formatcheck` and reformat all files
This commit is contained in:
Christian Schwarz 2020-09-01 00:12:10 +02:00 committed by GitHub
commit 67bbce3c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 55 additions and 7 deletions

View File

@ -60,6 +60,15 @@ jobs:
- run: make zrepl-bin
- run: make vet
- run:
shell: /bin/bash
command: |
needformat="$(make formatcheck)"
if [ -n "$needformat" ]; then
echo "$needformat"
exit 1
fi
exit 0
- run: make lint
- run: make release
- run: make test-go

View File

@ -202,14 +202,20 @@ cover-full:
##################### DEV TARGETS #####################
# not part of the build, must do that manually
.PHONY: generate format
.PHONY: generate formatcheck format
generate: generate-platform-test-list
protoc -I=replication/logic/pdu --go_out=plugins=grpc:replication/logic/pdu replication/logic/pdu/pdu.proto
$(GO_ENV_VARS) $(GO) generate $(GO_BUILDFLAGS) -x ./...
GOIMPORTS := goimports -srcdir . -local 'github.com/zrepl/zrepl'
FINDSRCFILES := find . -type f -name '*.go' -not -path "./vendor/*" -not -name '*.pb.go' -not -name '*_enumer.go'
formatcheck:
@ $(GOIMPORTS) -l $(shell $(FINDSRCFILES))
format:
goimports -srcdir . -local 'github.com/zrepl/zrepl' -w $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name '*.pb.go' -not -name '*_enumer.go')
@ $(GOIMPORTS) -w -d $(shell $(FINDSRCFILES))
##################### NOARCH #####################
.PHONY: noarch $(ARTIFACTDIR)/bash_completion $(ARTIFACTDIR)/_zrepl.zsh_completion $(ARTIFACTDIR)/go_env.txt docs docs-clean

View File

@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/config"

View File

@ -12,6 +12,7 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/endpoint"
"github.com/zrepl/zrepl/util/envconst"

View File

@ -10,6 +10,7 @@ import (
"text/template"
"github.com/stretchr/testify/require"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/config"

View File

@ -9,6 +9,7 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/log"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/config"

View File

@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zrepl/zrepl/endpoint"
"github.com/zrepl/zrepl/transport"
)

View File

@ -2,6 +2,7 @@ package job
import (
"github.com/pkg/errors"
"github.com/zrepl/zrepl/config"
"github.com/zrepl/zrepl/daemon/filters"
"github.com/zrepl/zrepl/endpoint"

View File

@ -6,6 +6,7 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/config"

View File

@ -7,6 +7,7 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/config"

View File

@ -9,6 +9,7 @@ import (
"github.com/mattn/go-isatty"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/config"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/logger"

View File

@ -100,6 +100,7 @@ import (
"github.com/kr/pretty"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/zrepl/zrepl/util/chainlock"
)

View File

@ -8,6 +8,7 @@ import (
"time"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/config"

View File

@ -10,6 +10,7 @@ import (
"github.com/kr/pretty"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/replication/logic/pdu"

View File

@ -6,6 +6,7 @@ import (
"sync"
"github.com/prometheus/client_golang/prometheus"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/util/chainlock"
)

View File

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/replication/logic/pdu"
"github.com/zrepl/zrepl/zfs"
)

View File

@ -6,6 +6,7 @@ import (
"regexp"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/zfs"
)

View File

@ -7,6 +7,7 @@ import (
"sort"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/zfs"
)

View File

@ -11,6 +11,7 @@ import (
"github.com/fatih/color"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/config"

View File

@ -4,6 +4,7 @@ import (
"path"
"github.com/stretchr/testify/require"
"github.com/zrepl/zrepl/platformtest"
"github.com/zrepl/zrepl/zfs"
)

View File

@ -4,6 +4,7 @@ import (
"fmt"
"github.com/stretchr/testify/assert"
"github.com/zrepl/zrepl/platformtest"
"github.com/zrepl/zrepl/zfs"
)

View File

@ -4,6 +4,7 @@ import (
"fmt"
"github.com/stretchr/testify/require"
"github.com/zrepl/zrepl/platformtest"
"github.com/zrepl/zrepl/zfs"
)

View File

@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zrepl/zrepl/platformtest"
"github.com/zrepl/zrepl/zfs"
)

View File

@ -10,6 +10,7 @@ import (
"github.com/kr/pretty"
"github.com/stretchr/testify/require"
"github.com/zrepl/zrepl/daemon/filters"
"github.com/zrepl/zrepl/endpoint"
"github.com/zrepl/zrepl/platformtest"

View File

@ -10,11 +10,12 @@ import (
"time"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/zfs"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/zfs"
"github.com/zrepl/zrepl/replication/report"
"github.com/zrepl/zrepl/util/chainlock"
"github.com/zrepl/zrepl/util/envconst"

View File

@ -10,6 +10,7 @@ import (
"time"
"github.com/stretchr/testify/require"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/replication/report"

View File

@ -12,6 +12,7 @@ import (
"github.com/montanaflynn/stats"
"github.com/stretchr/testify/assert"
"github.com/zrepl/zrepl/daemon/logging/trace"
)

View File

@ -9,6 +9,7 @@ import (
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/zrepl/zrepl/logger"

View File

@ -2,6 +2,7 @@ package logic
import (
"github.com/pkg/errors"
"github.com/zrepl/zrepl/config"
"github.com/zrepl/zrepl/replication/logic/pdu"
)

View File

@ -10,9 +10,10 @@ import (
"sync/atomic"
"time"
"github.com/zrepl/zrepl/daemon/logging/trace"
"google.golang.org/grpc"
"github.com/zrepl/zrepl/daemon/logging/trace"
"github.com/google/uuid"
"github.com/zrepl/zrepl/replication/logic"

View File

@ -8,8 +8,9 @@ import (
"strings"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/transport"
"golang.org/x/sys/unix"
"github.com/zrepl/zrepl/transport"
)
type ipMapEntry struct {

View File

@ -8,6 +8,7 @@ import (
"syscall"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/daemon/logging"
"github.com/zrepl/zrepl/logger"
"github.com/zrepl/zrepl/rpc/dataconn/timeoutconn"

View File

@ -3,8 +3,9 @@ package semaphore
import (
"context"
"github.com/zrepl/zrepl/daemon/logging/trace"
wsemaphore "golang.org/x/sync/semaphore"
"github.com/zrepl/zrepl/daemon/logging/trace"
)
type S struct {

View File

@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zrepl/zrepl/daemon/logging/trace"
)

View File

@ -7,6 +7,7 @@ import (
"fmt"
"github.com/pkg/errors"
"github.com/zrepl/zrepl/zfs/zfscmd"
)