Skip to content

Commit

Permalink
fix: lint fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
yusank committed Sep 2, 2022
1 parent 44fbf64 commit b599555
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/types/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func ParseIntBytes(id [8]byte) ID {

// MarshalJSON returns a json byte array string of the snowflake ID.
// Note: this is not regular MarshalJSON, it converts the ID to a base58 string,
// instead of a regular strconv.FormatInt(id,10).
// instead of a regular strconv.FormatInt(id,10).
func (f ID) MarshalJSON() ([]byte, error) {
b58 := f.Base58()
buff := make([]byte, 0, len(b58)+2)
Expand All @@ -257,7 +257,7 @@ func (f ID) MarshalJSON() ([]byte, error) {

// UnmarshalJSON converts a json byte array of a snowflake ID into an ID type.
// Note: this is not regular UnmarshalJSON, it converts the ID from a base58,
// instead of a regular strconv.ParseInt(id,10).
// instead of a regular strconv.ParseInt(id,10).
func (f *ID) UnmarshalJSON(b []byte) error {
if len(b) < 3 || b[0] != '"' || b[len(b)-1] != '"' {
return JSONSyntaxError{b}
Expand Down
15 changes: 8 additions & 7 deletions pkg/util/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
)

// Session generate session id
// switch tpye {
// case messagev1.SessionType_SingleChat:
// 001fromUIDtoUID
// case messagev1.SessionType_GroupChat:
// 010groupID00000000
// }
// to is groupID when type is groupChat
/*
switch tpye {
case messagev1.SessionType_SingleChat:
001fromUIDtoUID
case messagev1.SessionType_GroupChat:
010groupID00000000
}
*/
func Session(tp messagev1.SessionType, from, to types.ID) string {
// check if tp is valid
if tp > 0xFF || tp < 0 {
Expand Down

0 comments on commit b599555

Please sign in to comment.