Skip to content

Commit ab94643

Browse files
authored
chore: appease golangci and run CI on pull requests (#479)
1 parent ce5d2b8 commit ab94643

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/go.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
name: Go
22

33
on:
4+
pull_request:
5+
paths:
6+
- '**/*.go'
7+
- '**/go.mod'
8+
- '**/go.sum'
9+
- '.github/workflows/go.yml'
10+
411
push:
512
paths:
613
- '**/*.go'
714
- '**/go.mod'
815
- '**/go.sum'
916
- '.github/workflows/go.yml'
1017

18+
19+
# The if of each job prevents running the workflow if it's from a pull request from the directory the pull request is targeted towards
20+
# as it will already run on 'push'
1121
jobs:
1222
build:
23+
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
1324
runs-on: ubuntu-latest
1425
steps:
1526
- uses: actions/setup-go@v5
@@ -20,6 +31,7 @@ jobs:
2031
run: go build -v ./...
2132

2233
test:
34+
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
2335
runs-on: ubuntu-latest
2436
steps:
2537
- uses: actions/setup-go@v5
@@ -30,6 +42,7 @@ jobs:
3042
run: go test -v ./...
3143

3244
golangci:
45+
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
3346
runs-on: ubuntu-latest
3447
steps:
3548
- uses: actions/setup-go@v5

gateway/gateway_transports.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,9 @@ func (r *pipeBuffer) Read(p []byte) (int, error) {
135135
}
136136

137137
// Write appends the contents of p to the buffer, growing the buffer as
138-
// needed. The return value n is the length of p; err is always nil. If the
139-
// buffer becomes too large, Write will panic with [ErrTooLarge].
140-
func (r *pipeBuffer) Write(p []byte) (int, error) {
141-
return r.buffer.Write(p)
138+
// needed. If the buffer becomes too large, Write will panic with [ErrTooLarge].
139+
func (r *pipeBuffer) Write(p []byte) {
140+
_, _ = r.buffer.Write(p)
142141
}
143142

144143
// Reset resets the buffer to be empty, but it retains the underlying

0 commit comments

Comments
 (0)