Namespace returns the namespace (or scope) portion of a module ID, which is all but the last label of the ID. If the ID has only one label, then the namespace is empty.
()
| 101 | // which is all but the last label of the ID. If the ID has only one |
| 102 | // label, then the namespace is empty. |
| 103 | func (id ModuleID) Namespace() string { |
| 104 | lastDot := strings.LastIndex(string(id), ".") |
| 105 | if lastDot < 0 { |
| 106 | return "" |
| 107 | } |
| 108 | return string(id)[:lastDot] |
| 109 | } |
| 110 | |
| 111 | // Name returns the Name (last element) of a module ID. |
| 112 | func (id ModuleID) Name() string { |
no outgoing calls