如何使用特定键访问该结构的映射中的结构字段值

I have "FormError" struct. I pass this struct to my template. So how to access InputError struct field value with specific key in the template?

type InputError struct {
    Val string
    Has bool
}

type FormError struct {
    Errs map[string]InputError
}

This doesn't work.

<input name="Name" type="text" value="{{index .Errs.Val `Name`}}">

Use {{.Errs.Name.Val}}. There's no need to use index.

playground example

Errs.Val isn't valid, you need to separate the lookup and field access:

{{ $myval := index .Errs "key" }} {{ $myval.Val }}

Or if you only need to use the value once:

{{ (index .Errs "key").Val }}