Skip to content

add lock for concurrently writing to map #2289

add lock for concurrently writing to map

add lock for concurrently writing to map #2289

Workflow file for this run

name: TON - Go Code Linting
on:
pull_request:
permissions:
contents: read
env:
CONFIG_URL: https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/.golangci.yml
jobs:
golangci-lint:
name: Lint ${{ matrix.dir }}
runs-on: ubuntu-latest
strategy:
matrix:
dir: [integration-tests, pkg]
# REPORT_PATH will be, e.g.,
# integration-tests/golangci-lint-integration-tests-report.xml
env:
REPORT_PATH: ${{ format('{0}/golangci-lint-{0}-report.xml', matrix.dir) }}
steps:
- name: Check out code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Install Nix
uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Print golangci-lint version
run: nix develop -c golangci-lint --version
- name: Download and modify golangci-lint config
run: |
REPO_PREFIX="github.com/${{ github.repository }}"
curl -fsSL "${{ env.CONFIG_URL }}" | \
yq e ".formatters.settings.goimports.local-prefixes = [\"$REPO_PREFIX\"]" - \
> .golangci.yml
- name: Run golangci-lint
run: |
cd ${{ matrix.dir }}
nix develop -c golangci-lint run ./... \
--config ../.golangci.yml \
--output.checkstyle.path="${{ env.REPORT_PATH }}"
- name: Print lint report on failure
if: failure()
run: |
if [ -f "${{ env.REPORT_PATH }}" ]; then
cat "${{ env.REPORT_PATH }}"
else
echo "No report file found at: ${{ env.REPORT_PATH }}"
ls -la "$(dirname "${{ env.REPORT_PATH }}")"
fi
- name: Upload lint report
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.dir }}-lint-report
path: ${{ env.REPORT_PATH }}