Skip to content

hermes.Theme has no support for exported fields #84

@juliusmh

Description

@juliusmh

Given a Theme like this:

type Theme struct {
    Color string
    Logo  string
}

func (t *Theme) Name() string { ... }
func (t *Theme) HTMLTemplate() string { ... }
func (t *Theme) PlainTextTemplate() string { ... }

And calling hermes like this:

h := hermes.Hermes{
    Theme: new(Theme),
    // ...
}
email := hermes.Email{
    //  ...
}
html, err = h.GenerateHTML(email)
if err != nil {
	...
}

Will result int

panic: reflect: Field index out of range [recovered]
	panic: reflect: Field index out of range

The reason for this is the exported fields, which are tried to be merged into hermes.Default theme which is of type struct{}. Therefore it's not possible to have exported fields on a struct implementing hermes.Theme interface.

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