Skip to content

Commit

Permalink
code health: unify messages format in datetime
Browse files Browse the repository at this point in the history
After the patch all messages in datetime tests start with a capital
letter. All errors start with a lowecase letter [1].

1. https://github.com/golang/go/wiki/CodeReviewComments#error-strings
  • Loading branch information
oleg-jukovec committed Aug 11, 2022
1 parent f5cbb11 commit 6bac606
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion datetime/datetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewDatetime(t time.Time) (*Datetime, error) {
seconds := t.Unix()

if seconds < minSeconds || seconds > maxSeconds {
return nil, fmt.Errorf("Time %s is out of supported range.", t)
return nil, fmt.Errorf("time %s is out of supported range", t)
}

dt := new(Datetime)
Expand Down
8 changes: 4 additions & 4 deletions datetime/datetime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (t *Tuple1) DecodeMsgpack(d *decoder) error {
return err
}
if l != 1 {
return fmt.Errorf("array len doesn't match: %d", l)
return fmt.Errorf("Array len doesn't match: %d", l)
}
err = d.Decode(&t.Datetime)
if err != nil {
Expand Down Expand Up @@ -315,7 +315,7 @@ func (ev *Event) DecodeMsgpack(d *decoder) error {
return err
}
if l != 2 {
return fmt.Errorf("array len doesn't match: %d", l)
return fmt.Errorf("Array len doesn't match: %d", l)
}
if ev.Location, err = d.DecodeString(); err != nil {
return err
Expand All @@ -326,7 +326,7 @@ func (ev *Event) DecodeMsgpack(d *decoder) error {
}
var ok bool
if ev.Datetime, ok = toDatetime(res); !ok {
return fmt.Errorf("datetime doesn't match")
return fmt.Errorf("Datetime doesn't match")
}
return nil
}
Expand All @@ -352,7 +352,7 @@ func (c *Tuple2) DecodeMsgpack(d *decoder) error {
return err
}
if l != 3 {
return fmt.Errorf("array len doesn't match: %d", l)
return fmt.Errorf("Array len doesn't match: %d", l)
}
if c.Cid, err = d.DecodeUint(); err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions datetime/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ func Example() {
}
conn, err := tarantool.Connect("127.0.0.1:3013", opts)
if err != nil {
fmt.Printf("error in connect is %v", err)
fmt.Printf("Error in connect is %v", err)
return
}

var datetime = "2013-10-28T17:51:56.000000009Z"
tm, err := time.Parse(time.RFC3339, datetime)
if err != nil {
fmt.Printf("error in time.Parse() is %v", err)
fmt.Printf("Error in time.Parse() is %v", err)
return
}
dt, err := NewDatetime(tm)
Expand All @@ -47,7 +47,7 @@ func Example() {
// Replace a tuple with datetime.
resp, err := conn.Replace(space, []interface{}{dt})
if err != nil {
fmt.Printf("error in replace is %v", err)
fmt.Printf("Error in replace is %v", err)
return
}
respDt := resp.Data[0].([]interface{})[0].(Datetime)
Expand All @@ -60,7 +60,7 @@ func Example() {
var limit uint32 = 1
resp, err = conn.Select(space, index, offset, limit, tarantool.IterEq, []interface{}{dt})
if err != nil {
fmt.Printf("error in select is %v", err)
fmt.Printf("Error in select is %v", err)
return
}
respDt = resp.Data[0].([]interface{})[0].(Datetime)
Expand All @@ -71,7 +71,7 @@ func Example() {
// Delete a tuple with datetime.
resp, err = conn.Delete(space, index, []interface{}{dt})
if err != nil {
fmt.Printf("error in delete is %v", err)
fmt.Printf("Error in delete is %v", err)
return
}
respDt = resp.Data[0].([]interface{})[0].(Datetime)
Expand Down

0 comments on commit 6bac606

Please sign in to comment.