From 0da4dbe2322eb3b6224df35ce3e9fc83f104762b Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Thu, 14 Apr 2016 19:09:36 -0700 Subject: all: remove unnecessary type conversions cmd and runtime were handled separately, and I'm intentionally skipped syscall. This is the rest of the standard library. CL generated mechanically with github.com/mdempsky/unconvert. Change-Id: I9e0eff886974dedc37adb93f602064b83e469122 Reviewed-on: https://go-review.googlesource.com/22104 Reviewed-by: Brad Fitzpatrick Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot --- src/encoding/asn1/marshal.go | 6 +++--- src/encoding/binary/binary.go | 2 +- src/encoding/gob/encode.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/encoding') diff --git a/src/encoding/asn1/marshal.go b/src/encoding/asn1/marshal.go index 2b796c4e75..30797ef099 100644 --- a/src/encoding/asn1/marshal.go +++ b/src/encoding/asn1/marshal.go @@ -315,9 +315,9 @@ func marshalUTCTime(out *forkableWriter, t time.Time) (err error) { switch { case 1950 <= year && year < 2000: - err = marshalTwoDigits(out, int(year-1900)) + err = marshalTwoDigits(out, year-1900) case 2000 <= year && year < 2050: - err = marshalTwoDigits(out, int(year-2000)) + err = marshalTwoDigits(out, year-2000) default: return StructuralError{"cannot represent time as UTCTime"} } @@ -435,7 +435,7 @@ func marshalBody(out *forkableWriter, value reflect.Value, params fieldParameter return out.WriteByte(0) } case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return marshalInt64(out, int64(v.Int())) + return marshalInt64(out, v.Int()) case reflect.Struct: t := v.Type() diff --git a/src/encoding/binary/binary.go b/src/encoding/binary/binary.go index ada5768695..46c6add062 100644 --- a/src/encoding/binary/binary.go +++ b/src/encoding/binary/binary.go @@ -269,7 +269,7 @@ func Write(w io.Writer, order ByteOrder, data interface{}) error { case *uint8: b[0] = *v case uint8: - b[0] = byte(v) + b[0] = v case []uint8: bs = v case *int16: diff --git a/src/encoding/gob/encode.go b/src/encoding/gob/encode.go index 2b3a556eac..50cd6adb46 100644 --- a/src/encoding/gob/encode.go +++ b/src/encoding/gob/encode.go @@ -127,7 +127,7 @@ func (state *encoderState) encodeInt(i int64) { } else { x = uint64(i << 1) } - state.encodeUint(uint64(x)) + state.encodeUint(x) } // encOp is the signature of an encoding operator for a given type. -- cgit v1.3