Enable golangci-lint (attempt 2) (#23517)

This time we are just using the Makefile command
to see if that makes a difference
```release-note
NONE
```
This commit is contained in:
Agniva De Sarker 2023-05-30 15:16:42 +05:30 committed by GitHub
parent 20ec920b71
commit c7295b01e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 3 deletions

View File

@ -51,6 +51,27 @@ jobs:
run: make modules-tidy run: make modules-tidy
- name: Check modules - name: Check modules
run: if [[ -n $(git status --porcelain) ]]; then echo "Please tidy up the Go modules using make modules-tidy"; git diff; exit 1; fi run: if [[ -n $(git status --porcelain) ]]; then echo "Please tidy up the Go modules using make modules-tidy"; git diff; exit 1; fi
golangci:
name: golangci-lint
runs-on: ubuntu-22.04
defaults:
run:
working-directory: server
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
- name: Setup go.work
run: make setup-go-work
- name: Run golangci
run: make golangci-lint
check-gen-serialized: check-gen-serialized:
name: Check serialization methods for hot structs name: Check serialization methods for hot structs
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04

View File

@ -1,5 +1,5 @@
run: run:
timeout: 5m timeout: 10m
skip-dirs: skip-dirs:
- channels/store/storetest/mocks - channels/store/storetest/mocks

View File

@ -294,11 +294,11 @@ else
endif endif
golangci-lint: ## Run golangci-lint on codebase golangci-lint: ## Run golangci-lint on codebase
@# Keep the version in sync with the command in .circleci/config.yml
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
@echo Running golangci-lint @echo Running golangci-lint
$(GOBIN)/golangci-lint run ./... $(GOBIN)/golangci-lint run ./...
$(GOBIN)/golangci-lint run ./public/...
ifeq ($(BUILD_ENTERPRISE_READY),true) ifeq ($(BUILD_ENTERPRISE_READY),true)
ifneq ($(MM_NO_ENTERPRISE_LINT),true) ifneq ($(MM_NO_ENTERPRISE_LINT),true)
$(GOBIN)/golangci-lint run $(BUILD_ENTERPRISE_DIR)/... $(GOBIN)/golangci-lint run $(BUILD_ENTERPRISE_DIR)/...
@ -415,7 +415,7 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
endif endif
endif endif
check-style: golangci-lint plugin-checker vet ## Runs style/lint checks check-style: plugin-checker vet golangci-lint ## Runs style/lint checks
do-cover-file: ## Creates the test coverage report file. do-cover-file: ## Creates the test coverage report file.