|
| 1 | +name: "Go: workaround for indirect tracing" |
| 2 | +description: "Checks that our workaround for indirect tracing for Go 1.21+ on Linux works" |
| 3 | +# only Linux is affected |
| 4 | +operatingSystems: ["ubuntu"] |
| 5 | +# pinned to a version which does not support statically linked binaries for indirect tracing |
| 6 | +versions: ["stable-v2.14.6"] |
| 7 | +steps: |
| 8 | + - uses: actions/setup-go@v4 |
| 9 | + with: |
| 10 | + # We need a Go version that ships with statically linked binaries on Linux |
| 11 | + go-version: ">=1.21.0" |
| 12 | + - uses: ./../action/init |
| 13 | + with: |
| 14 | + languages: go |
| 15 | + tools: ${{ steps.prepare-test.outputs.tools-url }} |
| 16 | + - name: Build code |
| 17 | + shell: bash |
| 18 | + run: go build main.go |
| 19 | + - uses: ./../action/analyze |
| 20 | + with: |
| 21 | + upload-database: false |
| 22 | + - shell: bash |
| 23 | + run: | |
| 24 | + if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then |
| 25 | + echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \ |
| 26 | + "CODEQL_ACTION_GO_BINARY environment variable is not set." |
| 27 | + exit 1 |
| 28 | + fi |
| 29 | + if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then |
| 30 | + echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist." |
| 31 | + exit 1 |
| 32 | + fi |
| 33 | +
|
| 34 | +
|
| 35 | + # Once we start running Bash 4.2 in all environments, we can replace the |
| 36 | + # `! -z` flag with the more elegant `-v` which confirms that the variable |
| 37 | + # is actually unset and not potentially set to a blank value. |
| 38 | + if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then |
| 39 | + echo "Expected the Go autobuilder not to be run, but the" \ |
| 40 | + "CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set." |
| 41 | + exit 1 |
| 42 | + fi |
| 43 | + cd "$RUNNER_TEMP/codeql_databases" |
| 44 | + if [[ ! -d go ]]; then |
| 45 | + echo "Did not find a Go database" |
| 46 | + exit 1 |
| 47 | + fi |
0 commit comments