Skip to content

Commit 85030c3

Browse files
committed
Add CI
1 parent a216d03 commit 85030c3

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-go@v3
15+
with:
16+
go-version: ^1.20
17+
- uses: golangci/golangci-lint-action@v3
18+
name: golangci-lint
19+
with:
20+
version: v1.51.2
21+
- run: go test -count=1 -v ./...

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
issues:
2+
exclude-rules:
3+
- path: _test\.go
4+
linters:
5+
- errcheck

decoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func readN(src io.Reader, buf *bytes.Buffer, n int) ([]byte, error) {
158158
return nil, err
159159
}
160160
if k != n {
161-
k, err = src.Read(b[k:])
161+
_, err = src.Read(b[k:])
162162
}
163163

164164
return b, err

encoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (e *encoder) Uint32(u uint32) {
7575
// This is useful when overwriting a header field such as FieldsLen
7676
// because it is not known in advance.
7777
func (e *encoder) Uint32At(u, offset uint32) error {
78-
if offset < 0 || int(offset) >= e.dst.Len() {
78+
if int(offset) >= e.dst.Len() {
7979
return fmt.Errorf("offset is out of range: %d/%d", offset, e.dst.Len())
8080
}
8181

encoder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestEscapeBusLabel(t *testing.T) {
2323
buf.Reset()
2424

2525
escapeBusLabel(name, buf)
26-
got := string(buf.Bytes())
26+
got := buf.String()
2727
if want != got {
2828
t.Errorf("expected %q got %q", want, got)
2929
}

header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func decodeHeader(dec *decoder, conv *stringConverter, h *header, skipFields boo
125125
// A caller might already know the signature from the spec
126126
// and choose not to decode the fields as an optimization.
127127
if skipFields {
128-
if b, err = dec.ReadN(h.FieldsLen); err != nil {
128+
if _, err = dec.ReadN(h.FieldsLen); err != nil {
129129
return fmt.Errorf("message header: %w", err)
130130
}
131131
} else {

0 commit comments

Comments
 (0)