package template import ( "errors" ) var ErrPanelNotFound = errors.New("panel does not exist") // Panels contains a map with named panels. type Panels map[string]Panel // The Panel contains all the lines and extra points to draw a panel. type Panel struct { Points Points `yaml:"points"` Lines Lines `yaml:"lines"` Allowances Allowances `yaml:"allowances"` Name string `yaml:"name"` Information Information `yaml:"information"` } type Allowances struct { Hem string `yaml:"hem"` Seam string `yaml:"seam"` } func (t Template) Panel(name string) (Panel, error) { p, ok := t.Panels[name] if !ok { return Panel{}, ErrPanelNotFound } return p, nil }