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 () {
36
36
}
37
37
const goModDir = path . dirname ( goModPath )
38
38
39
- const goBuildTarget = path . normalize ( core . getInput ( 'go-build-target' ) )
39
+ let goBuildTarget = path . normalize ( core . getInput ( 'go-build-target' ) )
40
40
if ( goBuildTarget !== 'all' && goBuildTarget !== '...' ) {
41
41
if ( ! fs . existsSync ( goBuildTarget ) ) {
42
42
throw new Error ( `The build target '${ goBuildTarget } ' does not exist` )
43
43
}
44
44
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
+ }
48
52
}
49
53
}
50
54
51
55
const metadataInput = core . getInput ( 'metadata' )
52
- go ( goModDir , goBuildTarget , metadataInput )
56
+ processGoTarget ( goModDir , goBuildTarget , metadataInput )
53
57
}
54
58
55
- function go ( goModDir : string , goBuildTarget : string , metadataInput ?: string ) {
59
+ function processGoTarget ( goModDir : string , goBuildTarget : string , metadataInput ?: string ) {
56
60
process . chdir ( goModDir )
57
61
console . log (
58
62
`Running go package detection in ${ process . cwd ( ) } on build target ${ goBuildTarget } `
You can’t perform that action at this time.
0 commit comments