This repository was archived by the owner on Jun 16, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -36,23 +36,27 @@ async function detect () {
3636 }
3737 const goModDir = path . dirname ( goModPath )
3838
39- const goBuildTarget = path . normalize ( core . getInput ( 'go-build-target' ) )
39+ let goBuildTarget = path . normalize ( core . getInput ( 'go-build-target' ) )
4040 if ( goBuildTarget !== 'all' && goBuildTarget !== '...' ) {
4141 if ( ! fs . existsSync ( goBuildTarget ) ) {
4242 throw new Error ( `The build target '${ goBuildTarget } ' does not exist` )
4343 }
4444 if ( goModDir !== '.' && ! goBuildTarget . startsWith ( goModDir ) ) {
45- throw new Error (
46- `The build target ${ goBuildTarget } is not a sub-directory of ${ goModDir } `
47- )
45+ if ( goBuildTarget . startsWith ( goModDir ) ) {
46+ goBuildTarget = goBuildTarget . replace ( goModDir , '' )
47+ } else {
48+ throw new Error (
49+ `The build target ${ goBuildTarget } is not a sub-directory of ${ goModDir } `
50+ )
51+ }
4852 }
4953 }
5054
5155 const metadataInput = core . getInput ( 'metadata' )
52- go ( goModDir , goBuildTarget , metadataInput )
56+ processGoTarget ( goModDir , goBuildTarget , metadataInput )
5357}
5458
55- function go ( goModDir : string , goBuildTarget : string , metadataInput ?: string ) {
59+ function processGoTarget ( goModDir : string , goBuildTarget : string , metadataInput ?: string ) {
5660 process . chdir ( goModDir )
5761 console . log (
5862 `Running go package detection in ${ process . cwd ( ) } on build target ${ goBuildTarget } `
You can’t perform that action at this time.
0 commit comments