Merge 3db7409fa5cbd47064a5bb7dd3efee50c2bcd4e7 into 2e4d4f38962a6f15ae496d59b294f307eef95429

This commit is contained in:
Raju Ahmed 2026-06-22 17:00:41 +06:00 committed by GitHub
commit 9e5184e0fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 10 additions and 10 deletions

View File

@ -51,7 +51,7 @@ func (v *defaultValidator) ValidateStruct(obj any) error {
value := reflect.ValueOf(obj)
switch value.Kind() {
case reflect.Ptr:
case reflect.Pointer:
if value.Elem().Kind() != reflect.Struct {
return v.ValidateStruct(value.Elem().Interface())
}

View File

@ -13,7 +13,7 @@ import (
func BenchmarkSliceValidationError(b *testing.B) {
const size int = 100
e := make(SliceValidationError, size)
for j := 0; j < size; j++ {
for j := range size {
e[j] = errors.New(strconv.Itoa(j))
}

View File

@ -47,7 +47,7 @@ func mapFormByTag(ptr any, form map[string][]string, tag string) error {
// Check if ptr is a map
ptrVal := reflect.ValueOf(ptr)
var pointed any
if ptrVal.Kind() == reflect.Ptr {
if ptrVal.Kind() == reflect.Pointer {
ptrVal = ptrVal.Elem()
pointed = ptrVal.Interface()
}
@ -88,7 +88,7 @@ func mapping(value reflect.Value, field reflect.StructField, setter setter, tag
vKind := value.Kind()
if vKind == reflect.Ptr {
if vKind == reflect.Pointer {
var isNew bool
vPtr := value
if value.IsNil() {
@ -376,7 +376,7 @@ func setWithProperType(val string, value reflect.Value, field reflect.StructFiel
return json.API.Unmarshal(bytesconv.StringToBytes(val), value.Addr().Interface())
case reflect.Map:
return json.API.Unmarshal(bytesconv.StringToBytes(val), value.Addr().Interface())
case reflect.Ptr:
case reflect.Pointer:
if !value.Elem().IsValid() {
value.Set(reflect.New(value.Type().Elem()))
}

View File

@ -34,7 +34,7 @@ func (r *multipartRequest) TrySet(value reflect.Value, field reflect.StructField
func setByMultipartFormFile(value reflect.Value, field reflect.StructField, files []*multipart.FileHeader) (isSet bool, err error) {
switch value.Kind() {
case reflect.Ptr:
case reflect.Pointer:
switch value.Interface().(type) {
case *multipart.FileHeader:
value.Set(reflect.ValueOf(files[0]))

View File

@ -35,7 +35,7 @@ func decodePlain(data []byte, obj any) error {
v := reflect.ValueOf(obj)
for v.Kind() == reflect.Ptr {
for v.Kind() == reflect.Pointer {
if v.IsNil() {
return nil
}

View File

@ -155,7 +155,7 @@ func readNthLine(file string, n int) (string, error) {
defer f.Close()
scanner := bufio.NewScanner(f)
for i := 0; i < n; i++ {
for range n {
if !scanner.Scan() {
return "", nil
}

View File

@ -41,7 +41,7 @@ func waitForServerReady(url string, maxAttempts int) error {
Timeout: 100 * time.Millisecond,
}
for i := 0; i < maxAttempts; i++ {
for i := range maxAttempts {
resp, err := client.Get(url)
if err == nil {
resp.Body.Close()

View File

@ -28,7 +28,7 @@ const localhostIPv6 = "::1"
// Bind is a helper function for given interface object and returns a Gin middleware.
func Bind(val any) HandlerFunc {
value := reflect.ValueOf(val)
if value.Kind() == reflect.Ptr {
if value.Kind() == reflect.Pointer {
panic(`Bind struct can not be a pointer. Example:
Use: gin.Bind(Struct{}) instead of gin.Bind(&Struct{})
`)