-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug description
paramgen
panics with index out of range
if a field in an embedded struct has an invalid tag (for example, a validation tag).
Steps to reproduce
Save the following into a file in a directory called invalid3
, and run go mod init example.com/invalid3
:
package invalid3
type Config struct {
AnotherConfig
Param1 string
}
type AnotherConfig struct {
AnotherParam string `json:"anotherParam" validate:"inclusion=foo,bar"`
}
Run the following tests:
// Fails with:
// panic: runtime error: index out of range [0] with length 0 [recovered]
func TestConfig(t *testing.T) {
is := is.New(t)
_, _, err := ParseParameters("./invalid3", "Config")
is.NoErr(err)
}
// Fails with:
// err: [parseStructType] error parsing field "AnotherParam": [parseField] [parseIdent] invalid tag format
func TestAnotherConfig(t *testing.T) {
is := is.New(t)
_, _, err := ParseParameters("./invalid3", "AnotherConfig")
is.NoErr(err)
}
Version
SDK version v0.7.2
lovromazgon
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
No status