| 335 | } |
| 336 | |
| 337 | func dirsToModuleRootAbs(maindir, modroot string) []string { |
| 338 | var dirs = []string{maindir} |
| 339 | last := filepath.Join(maindir, "..") |
| 340 | // strip off path elements until we hit the module root |
| 341 | // adding `..`, `../..`, `../../..` until we're done |
| 342 | for maindir != modroot { |
| 343 | dirs = append(dirs, last) |
| 344 | last = filepath.Join(last, "..") |
| 345 | maindir = filepath.Dir(maindir) |
| 346 | } |
| 347 | return dirs |
| 348 | } |
| 349 | |
| 350 | // validateOutputFormat checks if the output file extension matches the expected format |
| 351 | func validateOutputFormat(outpath, expectedExt string) error { |