From 80fb3cb145c2371f4cacd2bcedacb8ebdf3b3d8e Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Tue, 24 Aug 2021 15:36:50 -0400 Subject: [PATCH] Run golangci-lint with the make lint-go target, adjust workflows (#1778) --- .github/workflows/test.yml | 19 ------------------- Makefile | 4 ++-- docs/3-Contributing/2-Testing.md | 8 +++++++- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 64b1bb5404..79bad42adb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -176,22 +176,3 @@ jobs: run: | MYSQL_TEST=1 make test-go - - lint-go: - strategy: - matrix: - os: [ubuntu-latest] - go-version: ['^1.16.0'] - runs-on: ${{ matrix.os }} - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: Checkout Code - uses: actions/checkout@v2 - - - name: Run Go Linting - run: | - make lint-go diff --git a/Makefile b/Makefile index 428b71431d..e1ad531b3e 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ lint-js: yarn lint lint-go: - go vet ./... + golangci-lint run lint: lint-go lint-js @@ -238,7 +238,7 @@ e2e-setup: ./build/fleetctl user create --context e2e --email=sso_user@example.com --name "SSO user" --sso=true e2e-serve-core: - FLEET_SOFTWARE_INVENTORY=1 ./build/fleet serve --mysql_address=localhost:3307 --mysql_username=root --mysql_password=toor --mysql_database=e2e --server_address=0.0.0.0:8642 + FLEET_SOFTWARE_INVENTORY=1 ./build/fleet serve --mysql_address=localhost:3307 --mysql_username=root --mysql_password=toor --mysql_database=e2e --server_address=0.0.0.0:8642 e2e-serve-basic: FLEET_SOFTWARE_INVENTORY=1 ./build/fleet serve --dev_license --mysql_address=localhost:3307 --mysql_username=root --mysql_password=toor --mysql_database=e2e --server_address=0.0.0.0:8642 diff --git a/docs/3-Contributing/2-Testing.md b/docs/3-Contributing/2-Testing.md index f690d2b984..8d8e363355 100644 --- a/docs/3-Contributing/2-Testing.md +++ b/docs/3-Contributing/2-Testing.md @@ -31,7 +31,13 @@ Check out [the instructions in the `/tools/osquery` directory](../../tools/osque ## Test suite -To execute the basic unit and integration tests, run the following from the root of the repository: +You must install the [`golangci-lint`](https://golangci-lint.run/) command to run `make test[-go]` or `make lint[-go]`, using: + +``` +go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.42.0 +``` + +Make sure it is available in your PATH. To execute the basic unit and integration tests, run the following from the root of the repository: ``` MYSQL_TEST=1 make test