Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
virtual-environments
Discontinued GitHub Actions runner images [Moved to: https://github.com/actions/runner-images]
Here's the full workflow.
First, we have to checkout the repository in GitHub Actions using GitHub's own checkout action. Then, we have to set up the Go version using GitHub's setup-go action. GitHub Actions has 3 different OSes available for their runners, each with various Go versions, but it's safest to explicitly specify which Go version will be used.
First, we have to checkout the repository in GitHub Actions using GitHub's own checkout action. Then, we have to set up the Go version using GitHub's setup-go action. GitHub Actions has 3 different OSes available for their runners, each with various Go versions, but it's safest to explicitly specify which Go version will be used.
Finally, we can use golangci-lint's provided GitHub Action for linting - it runs golangci-lint on the workflow runner's clone of the repo and outputs an error code if any Go file in the repo fails rules of any linters in golangci-lint. Note that golangci-lint fails if the AST cannot be parsed (i.e. if there are any syntax errors), so it can also be used for checking syntax correctness, which itself is a good proxy for checking for merge conflict strings. We can fail-fast with any checks this way - there's no need to spin up a compilation and a go test invocation if there are syntax errors.
Finally, we use a 3rd-party release creation Action for creating a release draft with the release notes and artifacts we just created:
Test syntax by running a linting check with golangci-lint - it's the best linter (actually, I suppose it's a meta-linter since it invokes several separate linters) available for Go and slaps your wrist if you slip into some well-known antipatterns.
Related posts
- Using Private Go Modules with golangci-lint in GitHub Actions
- Synchronize" a 3D scene across multiple windows using Three.js and localStorage
- Go linters configuration, the right version.
- Github Actions and Go
- Why do go tests hide console output by default, and what's the best way to get pretty output like MochaJS?