Fix the golint, gosimple warnings

This commit is contained in:
Murat Kabilov
2017-05-18 17:38:54 +02:00
committed by GitHub
parent 233e8529c1
commit d34273543e
19 changed files with 91 additions and 133 deletions
+4 -4
View File
@@ -33,7 +33,7 @@ type PostgresqlParam struct {
}
type ResourceDescription struct {
Cpu string `json:"cpu"`
CPU string `json:"cpu"`
Memory string `json:"memory"`
}
@@ -81,7 +81,7 @@ type PostgresSpec struct {
Patroni `json:"patroni,omitempty"`
Resources `json:"resources,omitempty"`
TeamId string `json:"teamId"`
TeamID string `json:"teamId"`
AllowedSourceRanges []string `json:"allowedSourceRanges"`
NumberOfInstances int32 `json:"numberOfInstances"`
Users map[string]UserFlags `json:"users"`
@@ -162,7 +162,7 @@ func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error {
}
if got.EndTime.Before(got.StartTime) {
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 !weekdayProvidedFrom || !weekdayProvidedTo {
@@ -228,7 +228,7 @@ func (p *Postgresql) UnmarshalJSON(data []byte) error {
}
tmp2 := Postgresql(tmp)
clusterName, err := clusterName(tmp2.Metadata.Name, tmp2.Spec.TeamId)
clusterName, err := clusterName(tmp2.Metadata.Name, tmp2.Spec.TeamID)
if err == nil {
tmp2.Spec.ClusterName = clusterName
} else {
+5 -5
View File
@@ -60,16 +60,16 @@ type UserSyncer interface {
ExecuteSyncRequests(req []PgSyncUserRequest, db *sql.DB) error
}
func (p NamespacedName) String() string {
if p.Namespace == "" && p.Name == "" {
func (n NamespacedName) String() string {
if n.Namespace == "" && n.Name == "" {
return ""
}
return types.NamespacedName(p).String()
return types.NamespacedName(n).String()
}
func (p NamespacedName) MarshalJSON() ([]byte, error) {
return []byte("\"" + p.String() + "\""), nil
func (n NamespacedName) MarshalJSON() ([]byte, error) {
return []byte("\"" + n.String() + "\""), nil
}
func (n *NamespacedName) Decode(value string) error {