mirror of
https://github.com/go-micro/go-micro.git
synced 2025-06-12 22:07:47 +02:00
improve code quality (#2128)
* Fix inefficient string comparison * Fix unnecessary calls to Printf * Canonicalize header key * Replace `t.Sub(time.Now())` with `time.Until` * Remove unnecessary blank (_) identifier * Remove unnecessary use of slice * Remove unnecessary comparison with bool
This commit is contained in:
committed by
GitHub
parent
0f0ace1a44
commit
26b859c4f9
@ -15,7 +15,7 @@ func decode(r io.Reader) (uint8, []byte, error) {
|
||||
header := make([]byte, 5)
|
||||
|
||||
// read the header
|
||||
if _, err := r.Read(header[:]); err != nil {
|
||||
if _, err := r.Read(header); err != nil {
|
||||
return uint8(0), nil, err
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ func encode(cf uint8, buf []byte, w io.Writer) error {
|
||||
binary.BigEndian.PutUint32(header[1:], uint32(len(buf)))
|
||||
|
||||
// read the header
|
||||
if _, err := w.Write(header[:]); err != nil {
|
||||
if _, err := w.Write(header); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user