Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add go linting tools to CI #51

Closed
vharsh opened this issue Jul 14, 2021 · 3 comments · Fixed by #60
Closed

Add go linting tools to CI #51

vharsh opened this issue Jul 14, 2021 · 3 comments · Fixed by #60
Assignees
Labels
good first issue Good for newcomers

Comments

@vharsh
Copy link
Member

vharsh commented Jul 14, 2021

Background

GolangCI-lint is a popular linter for go-projects which has support for a lot of popular linters like govet, golint, gofmt, etc, so it gets a bit easier than having to write individual shell scripts & complex Makefiles. It's super configurable so it's warnings can be silenced & it runs with similar toggles locally, i.e. the config file works well for the local development & CI.

It has a host of tools like golint, gofmt, govet and a bunch of unofficial tools like dupl, depguard, etc which should be added. Per the docs, using the official golangci-lint action might turn out to be a better approach than adding it via the Makefile in some other action/job.

@vharsh vharsh added the good first issue Good for newcomers label Jul 14, 2021
@burntcarrot
Copy link
Contributor

@vharsh I'd like to work on this, could you assign me?

@burntcarrot
Copy link
Contributor

I'm not sure where the Verify License task should go.

lint:
name: Golint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go_1
- name: Checkout
uses: actions/checkout@v2
- name: Run Golint
run: make golint
- name: Verify License
run: make license-check

And should this section be completely removed from the Makefile?

openebsctl/Makefile

Lines 66 to 73 in 9001fb0

.PHONY: golint
golint:
@echo "+ Installing golint"
@GO111MODULE=on go get -u golang.org/x/lint/golint;
@echo "--> Running golint"
@golint -set_exit_status $(PACKAGES)
@echo "Golint successful !"
@echo "--------------------------------"

Can you please clarify this?

@vharsh
Copy link
Member Author

vharsh commented Jul 17, 2021

@burntcarrot You can move the license checking part to goheader via GolangCI-lint & remove it from the go workflow.

Regarding the golint: target in Makefile, you can replace it with the golangci-lint run command & rename golint to golangci in Makefile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants