Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.24.0
go-version: 1.25.0

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.4.0

- name: Lint
run: golangci-lint run ./...
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.24.0
go-version: 1.25.0

- name: Test
run: go test -v ./...
3 changes: 2 additions & 1 deletion binding/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func (g GenericBinder) Bind(r *http.Request, a any) error {
field = field.Addr()
}
// Call the `FromRequest` method to extract data from the request and populate the field.
if err := field.Interface().(httpx.RequestExtractor).FromRequest(r); err != nil {
extractor, _ := reflect.TypeAssert[httpx.RequestExtractor](field)
if err := extractor.FromRequest(r); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/eatmoreapple/hx

go 1.24
go 1.25
3 changes: 2 additions & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ func (h requestHandler[Request]) createHandler(extractFunc func(any, *http.Reque

newRequest := func() Request {
if isPointer {
return reflect.New(elemType).Interface().(Request)
instance, _ := reflect.TypeAssert[Request](reflect.New(elemType))
return instance
}
return *new(Request)
}
Expand Down