( workPath: string, configuredEntrypoint?: string )
| 13 | * Checks the configured entrypoint first, then searches candidate locations. |
| 14 | */ |
| 15 | export async function detectGoEntrypoint( |
| 16 | workPath: string, |
| 17 | configuredEntrypoint?: string |
| 18 | ): Promise<string | null> { |
| 19 | // If the configured entrypoint exists, use it |
| 20 | if ( |
| 21 | configuredEntrypoint && |
| 22 | (await pathExists(join(workPath, configuredEntrypoint))) |
| 23 | ) { |
| 24 | debug(`Using configured Go entrypoint: ${configuredEntrypoint}`); |
| 25 | return configuredEntrypoint; |
| 26 | } |
| 27 | |
| 28 | // Search candidate locations |
| 29 | for (const candidate of GO_CANDIDATE_ENTRYPOINTS) { |
| 30 | if (await pathExists(join(workPath, candidate))) { |
| 31 | debug(`Detected Go entrypoint: ${candidate}`); |
| 32 | return candidate; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | return null; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Normalized entrypoint detector for Go services. Wraps {@link detectGoEntrypoint} |
no test coverage detected