Skip to content

Commit 104fabd

Browse files
Bump github.com/riverqueue/river/rivershared from 0.24.0 to 0.25.0 in the go-dependencies group across 1 directory (#24)
Updates `github.com/riverqueue/river/rivershared` from 0.24.0 to 0.25.0 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Blake Gentry <blakesgentry@gmail.com>
1 parent 70c9e67 commit 104fabd

12 files changed

Lines changed: 34 additions & 14 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
golangci-lint:
3030
runs-on: ubuntu-latest
3131
env:
32-
GOLANGCI_LINT_VERSION: v2.0.0
32+
GOLANGCI_LINT_VERSION: v2.4.0
3333

3434
steps:
3535
- name: Checkout

.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ linters:
2525
- ireturn # bans returning interfaces; questionable as is, but also buggy as hell; very, very annoying
2626
- lll # restricts maximum line length; annoying
2727
- nlreturn # requires a blank line before returns; annoying
28+
- noinlineerr # disallows `if err := ...`; because why miss an opportunity to leak variables out of scope?
2829
- wsl # a bunch of style/whitespace stuff; annoying
2930

3031
settings:

apiendpoint/api_endpoint.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func (m *EndpointMeta) validate() {
8585
if m.Pattern == "" {
8686
panic("Endpoint.Path is required")
8787
}
88+
8889
if m.StatusCode == 0 {
8990
panic("Endpoint.StatusCode is required")
9091
}
@@ -142,13 +143,15 @@ func executeAPIEndpoint[TReq any, TResp any](w http.ResponseWriter, r *http.Requ
142143

143144
err := func() error {
144145
var req TReq
146+
145147
if r.Method != http.MethodGet {
146148
reqData, err := io.ReadAll(r.Body)
147149
if err != nil {
148150
var maxBytesErr *http.MaxBytesError
149151
if errors.As(err, &maxBytesErr) {
150152
return apierror.NewRequestEntityTooLarge("Request entity too large.")
151153
}
154+
152155
return fmt.Errorf("error reading request body: %w", err)
153156
}
154157

@@ -213,12 +216,14 @@ func executeAPIEndpoint[TReq any, TResp any](w http.ResponseWriter, r *http.Requ
213216
logger.InfoContext(ctx, "API error response", logAttrs...)
214217

215218
apiErr.Write(ctx, logger, w)
219+
216220
return
217221
}
218222

219223
if errors.Is(err, context.DeadlineExceeded) {
220224
logger.ErrorContext(ctx, "request timeout", slog.String("error", err.Error()))
221225
apierror.NewServiceUnavailable("Request timed out. Retrying the request might work.").Write(ctx, logger, w)
226+
222227
return
223228
}
224229

apiendpoint/api_endpoint_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,18 @@ func mustMarshalJSON(t *testing.T, v any) []byte {
245245

246246
data, err := json.Marshal(v)
247247
require.NoError(t, err)
248+
248249
return data
249250
}
250251

251252
func mustUnmarshalJSON[T any](t *testing.T, data []byte) *T {
252253
t.Helper()
253254

254255
var val T
256+
255257
err := json.Unmarshal(data, &val)
256258
require.NoError(t, err)
259+
257260
return &val
258261
}
259262

@@ -315,6 +318,7 @@ func (a *getEndpoint) Execute(_ context.Context, req *getRequest) (*getResponse,
315318

316319
type postEndpoint struct {
317320
Endpoint[postRequest, postResponse]
321+
318322
MaxBodyBytes int64
319323
}
320324

@@ -341,6 +345,7 @@ func (req *postRequest) ExtractRaw(r *http.Request) error {
341345
}
342346

343347
req.ID = r.PathValue("id")
348+
344349
return nil
345350
}
346351

apierror/api_error_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@ func mustMarshalJSON(t *testing.T, v any) []byte {
7070

7171
data, err := json.Marshal(v)
7272
require.NoError(t, err)
73+
7374
return data
7475
}

apimiddleware/api_middleware.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ func NewMiddlewareStack(middlewares ...middlewareInterface) *MiddlewareStack {
5656
for _, mw := range middlewares {
5757
stack.Use(mw)
5858
}
59+
5960
return stack
6061
}
6162

6263
func (s *MiddlewareStack) Mount(handler http.Handler) http.Handler {
6364
for i := len(s.middlewares) - 1; i >= 0; i-- {
6465
handler = s.middlewares[i].Middleware(handler)
6566
}
67+
6668
return handler
6769
}
6870

apimiddleware/api_middleware_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func (m *contextTrailMiddleware) Middleware(next http.Handler) http.Handler {
3434
if existingTrail, ok := ctx.Value(contextTrailContextKey{}).([]string); ok {
3535
contextTrail = existingTrail
3636
}
37+
3738
contextTrail = append(contextTrail, m.segment)
3839

3940
next.ServeHTTP(w, r.WithContext(context.WithValue(ctx, contextTrailContextKey{}, contextTrail)))

apitest/apitest_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func TestInvokeHandler(t *testing.T) {
1919
type testRequest struct {
2020
RequiredReqField string `json:"req_field" validate:"required"`
2121
}
22+
2223
type testResponse struct {
2324
RequiredRespField string `json:"resp_field" validate:"required"`
2425
}

apitype/explicit_nullable.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ func ExtractExplicitNullableValueForValidation[T any](field reflect.Value) inter
4242
if !ok || !ps.Set || ps.Value == nil {
4343
return nil
4444
}
45+
4546
return ps.Value
4647
}

apitype/explicit_nullable_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func TestExplicitNullable_Validation(t *testing.T) {
5656
t.Parallel()
5757

5858
var payload testPayload
59+
5960
err := json.Unmarshal([]byte(tt.json), &payload)
6061
require.NoError(t, err)
6162

@@ -104,6 +105,7 @@ func TestExtractExplicitNullableValueForValidation(t *testing.T) {
104105
t.Parallel()
105106

106107
val := reflect.ValueOf(tt.input)
108+
107109
got := ExtractExplicitNullableValueForValidation[string](val)
108110
if tt.wantVal == nil {
109111
require.Nil(t, got)
@@ -159,6 +161,7 @@ func TestExplicitNullable_UnmarshalJSON(t *testing.T) {
159161
t.Parallel()
160162

161163
var got testPayload
164+
162165
err := json.Unmarshal([]byte(tt.json), &got)
163166

164167
if tt.wantErr {

0 commit comments

Comments
 (0)