From ac92696d3bdb41a522cedfef556401de31bcf701 Mon Sep 17 00:00:00 2001 From: Murat Kabilov Date: Wed, 24 May 2017 18:39:04 +0200 Subject: [PATCH] go fmt --- pkg/spec/postgresql.go | 4 ++-- pkg/spec/postgresql_test.go | 16 ++++++++-------- pkg/spec/types.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/spec/postgresql.go b/pkg/spec/postgresql.go index d673529f0..8ef7c2402 100644 --- a/pkg/spec/postgresql.go +++ b/pkg/spec/postgresql.go @@ -95,7 +95,7 @@ type PostgresqlList struct { } var alphaRegexp = regexp.MustCompile("^[a-zA-Z]*$") -var weekdays = map[string]int{"Sun":0, "Mon":1, "Tue":2, "Wed":3, "Thu":4, "Fri":5, "Sat":6} +var weekdays = map[string]int{"Sun": 0, "Mon": 1, "Tue": 2, "Wed": 3, "Thu": 4, "Fri": 5, "Sat": 6} func ParseTime(s string) (t time.Time, wd time.Weekday, wdProvided bool, err error) { var timeLayout string @@ -170,7 +170,7 @@ func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { return fmt.Errorf("'From' time must be prior to the 'To' time") } - if (int(got.StartWeekday) + 6) % 7 > (int(got.EndWeekday) + 6) % 7 { + if (int(got.StartWeekday)+6)%7 > (int(got.EndWeekday)+6)%7 { return fmt.Errorf("'From' weekday must be prior to the 'To' weekday") } diff --git a/pkg/spec/postgresql_test.go b/pkg/spec/postgresql_test.go index 0ec47821d..61e50de15 100644 --- a/pkg/spec/postgresql_test.go +++ b/pkg/spec/postgresql_test.go @@ -1,11 +1,11 @@ package spec import ( + "bytes" + "encoding/json" "reflect" "testing" "time" - "encoding/json" - "bytes" "k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/v1" @@ -178,9 +178,9 @@ var clExp = Postgresql{ PostgresqlParam: PostgresqlParam{ PgVersion: "9.6", Parameters: map[string]string{ - "shared_buffers": "32MB", + "shared_buffers": "32MB", "max_connections": "10", - "log_statement": "all", + "log_statement": "all", }, }, Volume: Volume{ @@ -206,14 +206,14 @@ var clExp = Postgresql{ TeamID: "ACID", AllowedSourceRanges: []string{"127.0.0.1/32"}, NumberOfInstances: 2, - Users: map[string]UserFlags{"zalando": UserFlags{"superuser", "createdb"}}, - MaintenanceWindows: []MaintenanceWindow{MaintenanceWindow{ + Users: map[string]UserFlags{"zalando": {"superuser", "createdb"}}, + MaintenanceWindows: []MaintenanceWindow{{ StartWeekday: time.Monday, StartTime: mustParseTime("01:00"), EndTime: mustParseTime("06:00"), EndWeekday: time.Sunday, }, - MaintenanceWindow{ + { StartWeekday: time.Saturday, StartTime: mustParseTime("00:00"), EndTime: mustParseTime("04:00"), @@ -344,4 +344,4 @@ func TestPostgresqlMarshal(t *testing.T) { if bytes.Compare(m, cl) != 0 { t.Errorf("Expected postgresql marshal: %s, got %s", string(cl), string(m)) } -} \ No newline at end of file +} diff --git a/pkg/spec/types.go b/pkg/spec/types.go index 7da8eb497..6eacb67eb 100644 --- a/pkg/spec/types.go +++ b/pkg/spec/types.go @@ -1,9 +1,9 @@ package spec import ( + "database/sql" "fmt" "strings" - "database/sql" "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/types"