Skip to content

Commit

Permalink
Add linting with golangci-lint
Browse files Browse the repository at this point in the history
To give a bit more consistency across the project with the Go
ecosystem, as well as picking up on some common errors that new
contributions can bring, enable golangci-lint, with default
configuration.
  • Loading branch information
Jamie Tanna committed Nov 12, 2022
1 parent 412867b commit f92f881
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,20 @@
name: Lint project
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Make sure this matches the version we've got in our `Makefile`
version: v1.50.1
12 changes: 12 additions & 0 deletions Makefile
@@ -1,3 +1,6 @@
GOBASE=$(shell pwd)
GOBIN=$(GOBASE)/bin

help:
@echo "This is a helper makefile for oapi-codegen"
@echo "Targets:"
Expand All @@ -6,6 +9,15 @@ help:
@echo " gin_example generate gin example server code"
@echo " tidy tidy go mod"

$(GOBIN)/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.50.1

.PHONY: tools
tools: $(GOBIN)/golangci-lint

lint: tools
$(GOBIN)/golangci-lint run ./...

generate:
go generate ./...

Expand Down

0 comments on commit f92f881

Please sign in to comment.