Skip to content

Commit

Permalink
trimpath input (#249)
Browse files Browse the repository at this point in the history
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max and crazy-max authored Jul 16, 2022
1 parent 4dfff0e commit f2e698d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
v: true
x: false
ldflags: -s -w
trimpath: true
working_dir: ./test
-
name: Check
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
race: false
ldflags: -s -w
buildmode: default
trimpath: true
```
## Customizing
Expand All @@ -72,6 +73,7 @@ Following inputs can be used as `step.with` keys
| `ldflags` | String | | Arguments to pass on each go tool link invocation |
| `buildmode` | String | `default` | Indicates which kind of object file to build |
| `buildvcs` | String | | Whether to stamp binaries with version control information |
| `trimpath` | Bool | `false` | Remove all file system paths from the resulting executable |
| `working_dir` | String | `$GITHUB_WORKSPACE` | Working directory |

## Limitation
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ inputs:
buildvcs:
description: 'Whether to stamp binaries with version control information'
required: false
trimpath:
description: 'Remove all file system paths from the resulting executable'
default: 'false'
required: false
working_dir:
description: 'Working directory'
required: false
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ async function run(): Promise<void> {
const ldflags = core.getInput('ldflags');
const buildmode = core.getInput('buildmode');
const buildvcs = core.getInput('buildvcs');
const trimpath = core.getInput('trimpath');
const workingDir = path.resolve(core.getInput('working_dir') || process.env['GITHUB_WORKSPACE'] || '.');

core.startGroup(`Download and install xgo`);
Expand Down Expand Up @@ -69,6 +70,9 @@ async function run(): Promise<void> {
if (buildvcs) {
args.push('-buildvcs', buildvcs);
}
if (/true/i.test(trimpath)) {
args.push('-trimpath');
}
args.push('.');

process.chdir(workingDir);
Expand Down

0 comments on commit f2e698d

Please sign in to comment.