Skip to content

"A": "gt=0.1,lt=0.9" there is a bad case in lt #1144

@ahaooahaz

Description

@ahaooahaz
  • I have looked at the documentation here first?
  • I have looked at the examples provided that may showcase my question here?

Package version eg. v9, v10: v10

Issue, Question or Enhancement: Issue

I found there is an bad case with lt=float

Code sample, to showcase or reproduce:

package main

import (
	"fmt"

	"github.com/go-playground/validator/v10"
)

type Data struct {
	A float32
}

var validate = validator.New()

func main() {
	data1 := Data{
		A: 0.9,
	}

        data1 := Data{
		A: 0.1,
	}

	rules := map[string]string{
		"A": "gt=0.1,lt=0.9",
	}

	validate.RegisterStructValidationMapRules(rules, Data{})

	err := validate.Struct(data1)
        err := validate.Struct(data2)
	fmt.Println(err)
	fmt.Println()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions