You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/09/16 14:07:05 UTC

[GitHub] [rocketmq-client-go] leyafo removed a comment on issue #210: fix unmarhsal messageID bug

leyafo removed a comment on issue #210: fix unmarhsal messageID bug
URL: https://github.com/apache/rocketmq-client-go/pull/210#issuecomment-531792758
 
 
   > > > yes, I find that the implement refers to Java SDK.
   > > > How do think about below:
   > > > ```
   > > >  ip := make([]byte, hex.DecodedLen(len(msgID[0:8])))
   > > >  ipLen, err := hex.Decode(ip, msgID[0:8])
   > > > ```
   > > 
   > > 
   > > two 16 hex characters are 16*16=1byte .
   > 
   > Yes, we are going to decode two hex characters to a byte.
   > See below as a test in this message_test:
   > 
   > ```
   > func main() {
   > 	id := []byte("0AAF0895000078BF000000000009BB4A")
   > 	ip := make([]byte, hex.DecodedLen(len(id[0:8])))
   > 	ipLen, _ := hex.Decode(ip, id[0:8])
   > 	fmt.Println(ip,ipLen)
   > }
   > ```
   > 
   > that prints
   > 
   > ```
   > [10 175 8 149] 4
   > ```
   > 
   > maybe, we do not need to follow the Java's implmetation.
   
   You're right, we should decode as native hex decode. I will change it again.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services