Skip to content

Commit

Permalink
Merge pull request #175 from fernomac/compiler-warnings
Browse files Browse the repository at this point in the history
address a few compiler warnings
  • Loading branch information
jobarr-amzn authored Mar 17, 2021
2 parents 84f0098 + e80b07b commit 4e5ade8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
5 changes: 1 addition & 4 deletions ion/binarywriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,7 @@ func (w *binaryWriter) WriteDecimal(val *Decimal) error {
// If the value is positive 0. (aka 0d0) then L is zero, there are no length or
// representation fields, and the entire value is encoded as the single byte 0x50.
if coef.Sign() == 0 && int64(exp) == 0 && !val.isNegZero {
buf := make([]byte, 0, 0)
buf = appendTag(buf, 0x50, 0)

return w.writeValue("Writer.WriteDecimal", buf)
return w.writeValue("Writer.WriteDecimal", []byte{0x50})
}

// Otherwise, length or representation fields are present and must be considered.
Expand Down
4 changes: 2 additions & 2 deletions ion/cmp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ func haveSameTypes(this, other interface{}) bool {
}

func getContainersType(in interface{}) interface{} {
switch in.(type) {
switch in := in.(type) {
case *string:
return in.(*string)
return in
case nil:
return nil
default:
Expand Down
3 changes: 2 additions & 1 deletion ion/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"math/big"
"reflect"
"sort"
"strconv"
"time"
)

Expand Down Expand Up @@ -446,7 +447,7 @@ func (m *Encoder) encodeTimeDate(v reflect.Value) error {
ns := t.Nanosecond()
numFractionalSeconds := 0
if ns > 0 {
numFractionalSeconds = len(string(ns))
numFractionalSeconds = len(strconv.Itoa(ns))
}

// Time.Date has nano second component
Expand Down
2 changes: 1 addition & 1 deletion ion/skipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ func (t *tokenizer) skipContainer(term int) (int, error) {
// char.
func (t *tokenizer) skipContainerHelper(term int) error {
if term != ']' && term != ')' && term != '}' {
panic(fmt.Sprintf("unexpected character: %v. Expected one of the closing container characters: ] } )", string(term)))
panic(fmt.Sprintf("unexpected character: %q. Expected one of the closing container characters: ] } )", term))
}

for {
Expand Down

0 comments on commit 4e5ade8

Please sign in to comment.