Skip to content

Commit

Permalink
all: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
enr0n committed Oct 1, 2024
1 parent 69f6b2f commit 15668b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions vici/client_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ func (cc *clientConn) packetRead(ctx context.Context) (*Message, error) {

return nil, ctx.Err()
case v := <-rc:
switch v.(type) {
switch v := v.(type) {
case error:
return nil, v.(error)
return nil, v
case *Message:
return v.(*Message), nil
return v, nil
default:
// This is a programmer error.
return nil, fmt.Errorf("%v: invalid packet read", errEncoding)
Expand Down
8 changes: 4 additions & 4 deletions vici/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,12 @@ func (m *Message) decode(data []byte) error {
return fmt.Errorf("%v: %v", errDecoding, err)
}

if name := buf.Next(int(l)); len(name) != int(l) {
name := buf.Next(int(l))
if len(name) != int(l) {
return errBadName
} else {
m.header.name = string(name)
}

m.header.name = string(name)
}

for buf.Len() > 0 {
Expand Down Expand Up @@ -609,7 +610,6 @@ func (m *Message) encodeSection(key string, section *Message) ([]byte, error) {

// Encode the sections elements
for k, v := range section.elements() {

rv := reflect.ValueOf(v)

var data []byte
Expand Down

0 comments on commit 15668b9

Please sign in to comment.