Skip to content

Commit

Permalink
golangci: Use gofumpt for formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatczuk committed Feb 4, 2021
1 parent 3c33302 commit 0a55c39
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .golangci-fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ run:
linters:
disable-all: true
enable:
- goimports
- gofumpt
2 changes: 1 addition & 1 deletion pkg/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestValidateTokenFailure(t *testing.T) {
verify := func(t *testing.T, r *http.Request, penalty time.Duration) {
t.Helper()

var bodyError = json.RawMessage(`{"message":"unauthorized","code":401}`)
bodyError := json.RawMessage(`{"message":"unauthorized","code":401}`)

w := httptest.NewRecorder()
ValidateToken("token", penalty, bodyError)(h).ServeHTTP(w, r)
Expand Down
27 changes: 18 additions & 9 deletions pkg/callhome/callhome_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ func TestChecker(t *testing.T) {
Available: "v1.0.0",
},
Status: "md",
}, {
},
{
Name: "daily install equal version",
InstalledVersion: "v1.0.0-0.20200123.7cf18f6b",
LatestVersion: "v1.0.0",
Expand All @@ -75,7 +76,8 @@ func TestChecker(t *testing.T) {
Available: "v1.0.0",
},
Status: "mi",
}, {
},
{
Name: "docker equal version",
InstalledVersion: "v1.0.0-0.20200123.7cf18f6b",
LatestVersion: "v1.0.0",
Expand All @@ -87,7 +89,8 @@ func TestChecker(t *testing.T) {
Available: "v1.0.0",
},
Status: "mdd",
}, {
},
{
Name: "docker install equal version",
InstalledVersion: "v1.0.0-0.20200123.7cf18f6b",
LatestVersion: "v1.0.0",
Expand All @@ -99,7 +102,8 @@ func TestChecker(t *testing.T) {
Available: "v1.0.0",
},
Status: "mdi",
}, {
},
{
Name: "version outdated",
InstalledVersion: "v1.0.0-0.20200123.7cf18f6b",
LatestVersion: "v1.0.1",
Expand All @@ -109,7 +113,8 @@ func TestChecker(t *testing.T) {
Available: "v1.0.1",
},
Status: "md",
}, {
},
{
Name: "check version ahead",
InstalledVersion: "v1.0.0-0.20200123.7cf18f6b",
LatestVersion: "v0.9.1",
Expand All @@ -119,7 +124,8 @@ func TestChecker(t *testing.T) {
Available: "v0.9.1",
},
Status: "md",
}, {
},
{
Name: "master version",
InstalledVersion: "666.dev-0.20200902.a6a8ce8e",
LatestVersion: "v0.9.1",
Expand All @@ -129,7 +135,8 @@ func TestChecker(t *testing.T) {
Available: "v0.9.1",
},
Status: "md",
}, {
},
{
Name: "long master version",
InstalledVersion: "666.development-0.20200325.9fee712d62",
LatestVersion: "v0.9.1",
Expand All @@ -139,7 +146,8 @@ func TestChecker(t *testing.T) {
Available: "v0.9.1",
},
Status: "md",
}, {
},
{
Name: "master version with v prefix",
InstalledVersion: "v666.dev-0.20200902.a6a8ce8e",
LatestVersion: "v0.9.1",
Expand All @@ -149,7 +157,8 @@ func TestChecker(t *testing.T) {
Available: "v0.9.1",
},
Status: "md",
}, {
},
{
Name: "long master version with v prefix",
InstalledVersion: "v666.development-0.20200325.9fee712d62",
LatestVersion: "v0.9.1",
Expand Down
6 changes: 4 additions & 2 deletions pkg/managerclient/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func TestParseStartDate(t *testing.T) {
},
{
S: "now-5s",
E: "start date cannot be in the past"},
E: "start date cannot be in the past",
},
{
S: "now+5s",
E: "start date must be at least in",
Expand All @@ -86,7 +87,8 @@ func TestParseStartDate(t *testing.T) {
},
{
S: timeutc.Now().Add(-5 * time.Second).Format(time.RFC3339),
E: "start date cannot be in the past"},
E: "start date cannot be in the past",
},
{
S: timeutc.Now().Add(5 * time.Second).Format(time.RFC3339),
E: "start date must be at least in",
Expand Down
6 changes: 4 additions & 2 deletions pkg/scyllaclient/config_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import (
"github.com/scylladb/scylla-manager/pkg/scyllaclient/scyllaclienttest"
)

type configClientFunc func(context.Context) (string, error)
type configClientBindFunc func(client *scyllaclient.ConfigClient) configClientFunc
type (
configClientFunc func(context.Context) (string, error)
configClientBindFunc func(client *scyllaclient.ConfigClient) configClientFunc
)

func TestClientConfigReturnsResponseFromScylla(t *testing.T) {
t.Parallel()
Expand Down
3 changes: 1 addition & 2 deletions pkg/scyllaclient/timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ func TestCustomTimeout(t *testing.T) {
_, err := client.Ping(test.Context, host, test.Timeout)
close(done)

var golden = fmt.Sprintf("after %s: timeout", test.ExpectedTimeout)
golden := fmt.Sprintf("after %s: timeout", test.ExpectedTimeout)
if err == nil || err.Error() != golden {
t.Fatalf("Ping() error = %v, expected %s", err, golden)
}
})
}

}
8 changes: 5 additions & 3 deletions pkg/service/backup/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ func ParsePartialPath(s string) (remoteManifest, error) {
return m, m.ParsePartialPath(s)
}

type RemoteManifest = remoteManifest
type ManifestContent = manifestContent
type FileInfo = fileInfo
type (
RemoteManifest = remoteManifest
ManifestContent = manifestContent
FileInfo = fileInfo
)

func RemoteManifestDir(clusterID uuid.UUID, dc, nodeID string) string {
return remoteManifestDir(clusterID, dc, nodeID)
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/backup/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func TestCatLimitIsEnoughToDownloadManifest(t *testing.T) {
tokensRanges = 256
)

var metaFilesFormats = []string{
metaFilesFormats := []string{
"mc-%d-big-Data.db",
"mc-%d-big-Index.db",
"mc-%d-big-Scylla.db",
Expand Down
1 change: 0 additions & 1 deletion pkg/service/repair/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ func TestRepairUpdateMetrics(t *testing.T) {
if err := testutil.CollectAndCompare(repairProgress, bytes.NewBufferString(golden)); err != nil {
t.Fatal(err)
}

}
3 changes: 1 addition & 2 deletions pkg/service/repair/progress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
. "github.com/scylladb/scylla-manager/pkg/testutils"
)

type nopProgressManager struct {
}
type nopProgressManager struct{}

var _ progressManager = &nopProgressManager{}

Expand Down
2 changes: 1 addition & 1 deletion pkg/util/duration/duration_string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func TestDurationString(t *testing.T) {
t.Parallel()

var table = []struct {
table := []struct {
S string
D time.Duration
}{
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/inexlist/inexlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestParseInExList(t *testing.T) {
var table = []struct {
table := []struct {
P []string
E InExList
}{
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestParseInExList(t *testing.T) {
}

func TestInExListFilter(t *testing.T) {
var table = []struct {
table := []struct {
P []string
I []string
out []string
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/inexlist/ksfilter/ksfilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestSortUnits(t *testing.T) {

defaultTables := []string{"t"}

var table = []struct {
table := []struct {
P []string
U []string
E []string
Expand Down

0 comments on commit 0a55c39

Please sign in to comment.