CollectLibraryPaths returns a list of paths which should be added to LD_LIBRARY_PATH given a list of extensions mounted under baseDir. NOTE: filepath.Join normalizes user-supplied paths (e.g. leading "/", "./" or trailing "/" are cleaned), so "/lib", "./lib", and "lib" all resolve to the same direct
(extensionList []apiv1.ExtensionConfiguration, baseDir string)
| 144 | // trailing "/" are cleaned), so "/lib", "./lib", and "lib" all resolve to the |
| 145 | // same directory under the extension mount point. |
| 146 | func CollectLibraryPaths(extensionList []apiv1.ExtensionConfiguration, baseDir string) []string { |
| 147 | capacity := 0 |
| 148 | for _, ext := range extensionList { |
| 149 | capacity += len(ext.LdLibraryPath) |
| 150 | } |
| 151 | result := make([]string, 0, capacity) |
| 152 | |
| 153 | for _, extension := range extensionList { |
| 154 | for _, libraryPath := range extension.LdLibraryPath { |
| 155 | result = append( |
| 156 | result, |
| 157 | filepath.Join(baseDir, extension.Name, libraryPath), |
| 158 | ) |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | return result |
| 163 | } |
| 164 | |
| 165 | // dedicatedEnvVars names env vars whose values come from dedicated extension |
| 166 | // fields (LdLibraryPath, BinPath); custom Env entries targeting them are skipped. |
no test coverage detected