From d53e5dac2e92814bbcd39bf1902778e7745c0bfb Mon Sep 17 00:00:00 2001 From: David Marinho Date: Tue, 14 Mar 2023 12:50:23 +0000 Subject: [PATCH 1/3] fix installation staticcheck using official binary --- action.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index abf14ff..92c89b2 100644 --- a/action.yml +++ b/action.yml @@ -136,7 +136,10 @@ runs: else echo "Skipping GoSec" fi - + - name: set-up go + uses: actions/setup-go@v3 + with: + go-version: 1.20.2 - name: "Run StaticCheck" shell: bash run: | @@ -144,18 +147,14 @@ runs: if [ "${{ inputs.run-staticcheck }}" == "true" ]; then cd /tmp - curl -fsSL https://api.github.com/repos/dominikh/go-tools/releases/latest \ - | grep -E "browser_download_url.*staticcheck_linux_amd64.tar.gz\"$" \ - | cut -d '"' -f 4 \ - | xargs -L 1 curl -fsSL -o /tmp/staticcheck_linux_amd64.tar.gz - tar -xvf /tmp/staticcheck_linux_amd64.tar.gz staticcheck/staticcheck - chmod +x ./staticcheck/staticcheck + go install honnef.co/go/tools/cmd/staticcheck@latest + chmod +x /home/runner/go/bin/staticcheck CODACY_STATICCHECK_VERSION=$(curl -SL "https://artifacts.codacy.com/bin/codacy-staticcheck/latest" -o-) curl -fsSL "https://artifacts.codacy.com/bin/codacy-staticcheck/$CODACY_STATICCHECK_VERSION/codacy-staticcheck-$CODACY_STATICCHECK_VERSION" -o /tmp/codacy-staticcheck chmod +x /tmp/codacy-staticcheck cd - - find . -type f -name go.mod -exec bash -c 'cd $(dirname $1); cp $1 $1.codacy.bak; PKGS=$(go list ./...); /tmp/staticcheck/staticcheck -f json $PKGS; mv $1.codacy.bak $1' _ {} \; > /tmp/staticcheck-out.json + find . -type f -name go.mod -exec bash -c 'cd $(dirname $1); cp $1 $1.codacy.bak; PKGS=$(go list ./...); /home/runner/go/bin/staticcheck -f json $PKGS; mv $1.codacy.bak $1' _ {} \; > /tmp/staticcheck-out.json /tmp/codacy-staticcheck < /tmp/staticcheck-out.json > /tmp/codacy-out.json if [ ${{ inputs.upload }} = true ]; then curl -XPOST -L -H "$CURL_CODACY_AUTH_AUTHENTICATION" \ From 3bb21bd51b24ba774b8520b5abfc7bf28253198e Mon Sep 17 00:00:00 2001 From: David Marinho Date: Tue, 14 Mar 2023 14:29:02 +0000 Subject: [PATCH 2/3] fix action.yml file --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 92c89b2..749d91e 100644 --- a/action.yml +++ b/action.yml @@ -137,9 +137,9 @@ runs: echo "Skipping GoSec" fi - name: set-up go - uses: actions/setup-go@v3 - with: - go-version: 1.20.2 + uses: actions/setup-go@v3 + with: + go-version: 1.20.2 - name: "Run StaticCheck" shell: bash run: | From 7ccdf09ead8cf115e985c9949df835113f6d581e Mon Sep 17 00:00:00 2001 From: David Marinho Date: Thu, 16 Mar 2023 11:53:11 +0000 Subject: [PATCH 3/3] fix staticcheck version --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 749d91e..ccfc2ba 100644 --- a/action.yml +++ b/action.yml @@ -147,7 +147,7 @@ runs: if [ "${{ inputs.run-staticcheck }}" == "true" ]; then cd /tmp - go install honnef.co/go/tools/cmd/staticcheck@latest + go install honnef.co/go/tools/cmd/staticcheck@2023.1.2 chmod +x /home/runner/go/bin/staticcheck CODACY_STATICCHECK_VERSION=$(curl -SL "https://artifacts.codacy.com/bin/codacy-staticcheck/latest" -o-) curl -fsSL "https://artifacts.codacy.com/bin/codacy-staticcheck/$CODACY_STATICCHECK_VERSION/codacy-staticcheck-$CODACY_STATICCHECK_VERSION" -o /tmp/codacy-staticcheck