ServiceFor creates a new or returns the existing service definition for the given service.
(s *ServiceExpr, root *HTTPExpr)
| 63 | // ServiceFor creates a new or returns the existing service definition for the |
| 64 | // given service. |
| 65 | func (h *HTTPExpr) ServiceFor(s *ServiceExpr, root *HTTPExpr) *HTTPServiceExpr { |
| 66 | if res := h.Service(s.Name); res != nil { |
| 67 | return res |
| 68 | } |
| 69 | res := &HTTPServiceExpr{ |
| 70 | ServiceExpr: s, |
| 71 | Root: root, |
| 72 | } |
| 73 | h.Services = append(h.Services, res) |
| 74 | return res |
| 75 | } |
| 76 | |
| 77 | // EvalName returns the name printed in case of evaluation error. |
| 78 | func (*HTTPExpr) EvalName() string { |