Skip to content

Inline structs are not supported #242

@infogulch

Description

@infogulch

I'm using inline embedded structs to add structure to my config for json encoding without having to explicitly name a bunch of sub-structs, but go-arg doesn't like it:

var args struct {
	A struct {
		B string
		C string
	}
	D string
}
arg.MustParse(&args)
$ go run . -h
.A: struct { B string; C string } fields are not supported
exit status 255

I see that the docs say it supports embedded structs, but it doesn't mention inline embedded struct (my name, perhaps there's a more formal name). Is this intentionally unsupported, or is it more of an oversight / "didn't think of doing it like that before"? Would you consider adding support for these types of struct definitions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions