GetDef returns the type definitions for a given state This is the main getter function for a module definition.
(st *ShellState)
| 995 | // |
| 996 | // This is the main getter function for a module definition. |
| 997 | func (h *shellCallHandler) GetDef(st *ShellState) *moduleDef { |
| 998 | dig := h.modDigest() |
| 999 | |
| 1000 | if st != nil && st.ModDigest != "" && st.ModDigest != dig { |
| 1001 | dig = st.ModDigest |
| 1002 | } |
| 1003 | |
| 1004 | if def := h.loadModDef(dig); def != nil { |
| 1005 | return def |
| 1006 | } |
| 1007 | |
| 1008 | // Every time the default module ref is set, there should be a corresponding |
| 1009 | // value in h.modDefs. Otherwise there's a bug in the CLI. |
| 1010 | panic(fmt.Sprintf("module %q not loaded", dig)) |
| 1011 | } |
| 1012 | |
| 1013 | func (h *shellCallHandler) GetDependency(ctx context.Context, name string) (*ShellState, *moduleDef, error) { |
| 1014 | modDef := h.GetDef(nil) |
no test coverage detected