mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-19 14:04:28 +02:00
go fmt
This commit is contained in:
@@ -95,7 +95,7 @@ type PostgresqlList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var alphaRegexp = regexp.MustCompile("^[a-zA-Z]*$")
|
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) {
|
func ParseTime(s string) (t time.Time, wd time.Weekday, wdProvided bool, err error) {
|
||||||
var timeLayout string
|
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")
|
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")
|
return fmt.Errorf("'From' weekday must be prior to the 'To' weekday")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package spec
|
package spec
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
"encoding/json"
|
|
||||||
"bytes"
|
|
||||||
|
|
||||||
"k8s.io/client-go/pkg/api/unversioned"
|
"k8s.io/client-go/pkg/api/unversioned"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
@@ -178,9 +178,9 @@ var clExp = Postgresql{
|
|||||||
PostgresqlParam: PostgresqlParam{
|
PostgresqlParam: PostgresqlParam{
|
||||||
PgVersion: "9.6",
|
PgVersion: "9.6",
|
||||||
Parameters: map[string]string{
|
Parameters: map[string]string{
|
||||||
"shared_buffers": "32MB",
|
"shared_buffers": "32MB",
|
||||||
"max_connections": "10",
|
"max_connections": "10",
|
||||||
"log_statement": "all",
|
"log_statement": "all",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Volume: Volume{
|
Volume: Volume{
|
||||||
@@ -206,14 +206,14 @@ var clExp = Postgresql{
|
|||||||
TeamID: "ACID",
|
TeamID: "ACID",
|
||||||
AllowedSourceRanges: []string{"127.0.0.1/32"},
|
AllowedSourceRanges: []string{"127.0.0.1/32"},
|
||||||
NumberOfInstances: 2,
|
NumberOfInstances: 2,
|
||||||
Users: map[string]UserFlags{"zalando": UserFlags{"superuser", "createdb"}},
|
Users: map[string]UserFlags{"zalando": {"superuser", "createdb"}},
|
||||||
MaintenanceWindows: []MaintenanceWindow{MaintenanceWindow{
|
MaintenanceWindows: []MaintenanceWindow{{
|
||||||
StartWeekday: time.Monday,
|
StartWeekday: time.Monday,
|
||||||
StartTime: mustParseTime("01:00"),
|
StartTime: mustParseTime("01:00"),
|
||||||
EndTime: mustParseTime("06:00"),
|
EndTime: mustParseTime("06:00"),
|
||||||
EndWeekday: time.Sunday,
|
EndWeekday: time.Sunday,
|
||||||
},
|
},
|
||||||
MaintenanceWindow{
|
{
|
||||||
StartWeekday: time.Saturday,
|
StartWeekday: time.Saturday,
|
||||||
StartTime: mustParseTime("00:00"),
|
StartTime: mustParseTime("00:00"),
|
||||||
EndTime: mustParseTime("04:00"),
|
EndTime: mustParseTime("04:00"),
|
||||||
@@ -344,4 +344,4 @@ func TestPostgresqlMarshal(t *testing.T) {
|
|||||||
if bytes.Compare(m, cl) != 0 {
|
if bytes.Compare(m, cl) != 0 {
|
||||||
t.Errorf("Expected postgresql marshal: %s, got %s", string(cl), string(m))
|
t.Errorf("Expected postgresql marshal: %s, got %s", string(cl), string(m))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,9 +1,9 @@
|
|||||||
package spec
|
package spec
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"database/sql"
|
|
||||||
|
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/types"
|
"k8s.io/client-go/pkg/types"
|
||||||
|
|||||||
Reference in New Issue
Block a user