StableSourceKey reduces a Sources map key to its stable identity: the part that persists across variant selectors and caller/environment metadata. For URL references the identity is the URL's path (scheme + host + path); the entire query string and fragment are treated as volatile. This is what let
(key string)
| 135 | // identity when it resolves unambiguously, so collapsing distinct query strings |
| 136 | // to one identity never silently selects the wrong side-by-side variant. |
| 137 | func StableSourceKey(key string) string { |
| 138 | decoded, err := url.QueryUnescape(key) |
| 139 | if err != nil { |
| 140 | return key |
| 141 | } |
| 142 | if !IsURLReference(decoded) { |
| 143 | return key |
| 144 | } |
| 145 | u, err := url.Parse(decoded) |
| 146 | if err != nil { |
| 147 | return key |
| 148 | } |
| 149 | u.RawQuery = "" |
| 150 | u.Fragment = "" |
| 151 | return u.String() |
| 152 | } |
| 153 | |
| 154 | // resolveDirectory enumerates YAML files in a directory and resolves each one. |
| 155 | func resolveDirectory(dirPath string, envProvider environment.Provider) (Sources, error) { |