Skip to content

Commit

Permalink
upgrade go to v1.17 to fix issue #348 for 2.0 branch (#353)
Browse files Browse the repository at this point in the history
* mark array types deprecated (#347)

* mark array types deprected

* mark array types deprecated

* Update README.md

change readme title

* upgrade go to v1.17 to fix issue #348

---------

Co-authored-by: Xin.Zh <dragoncharlie@foxmail.com>
  • Loading branch information
tiltwind and AlexStocks committed Feb 24, 2023
1 parent 6ea8710 commit 2976f7b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
os:
- ubuntu-latest
go_version:
- 1.13
- 1.17
jdk_version:
- 1.8
env:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gohessian
# dubbo-go-hessian2

[![Build Status](https://travis-ci.org/apache/dubbo-go-hessian2.png?branch=master)](https://travis-ci.org/apache/dubbo-go-hessian2)
[![codecov](https://codecov.io/gh/apache/dubbo-go-hessian2/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/dubbo-go-hessian2)
Expand Down
6 changes: 3 additions & 3 deletions date.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func encDateInMs(b []byte, i interface{}) []byte {
return append(b, BC_NULL)
}
b = append(b, BC_DATE)
return append(b, PackInt64(vi.UnixNano()/1e6)...)
return append(b, PackInt64(vi.UnixMilli())...)
}

func encDateInMimute(b []byte, v time.Time) []byte {
func encDateInMinute(b []byte, v time.Time) []byte {
b = append(b, BC_DATE_MINUTE)
return append(b, PackInt32(int32(v.UnixNano()/60e9))...)
return append(b, PackInt32(int32(v.Unix()/60))...)
}

/////////////////////////////////////////
Expand Down
16 changes: 16 additions & 0 deletions date_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ func TestEncDate(t *testing.T) {
d = NewDecoder(e.Buffer())
res, err = d.Decode()
t.Logf("decode(%s, %s) = %v, %v\n", v, tz.Local(), res, err)
assert.Equal(t, tz.Local(), res)
}

func TestEncDateIssue348(t *testing.T) {
e := NewEncoder()
v := "2914-02-09 06:15:23"
tz, _ := time.Parse("2006-01-02 15:04:05", v)
e.Encode(tz)
if len(e.Buffer()) == 0 {
t.Fail()
}

d := NewDecoder(e.Buffer())
res, err := d.Decode()
t.Logf("decode(%s, %s) = %v, %v\n", v, tz.Local(), res, err)
assert.Equal(t, tz.Local(), res)
}

func testDateFramework(t *testing.T, method string, expected time.Time) {
Expand Down

0 comments on commit 2976f7b

Please sign in to comment.