Skip to content

fmt: introduce golangci-lint and go vet use CI with action and using build tag#804

Draft
gen2thomas wants to merge 1 commit intotinygo-org:devfrom
gen2thomas:feature/linter_add_build_tags
Draft

fmt: introduce golangci-lint and go vet use CI with action and using build tag#804
gen2thomas wants to merge 1 commit intotinygo-org:devfrom
gen2thomas:feature/linter_add_build_tags

Conversation

@gen2thomas
Copy link

@gen2thomas gen2thomas commented Oct 22, 2025

see #802 for a general description and the version without Github action
see #803 for version with multiple runners

This PR is an alternative way to earn all features of the golangci-lint GitHub Action.

This is achieved by adding a build tag to every file that cannot be linted due to a failed compilation. This is caused by dependencies to the "machine" package of tiny-go or other such dependencies (e.g. device/arm).

Although the condition is to add a build tag in many files, it has many advantages over the other versions:

  • generic approach for running "go vet" and "golangci-lint" without any boilerplate code, locally (Makefile) and in CI
  • incredible fast (takes 30 sec. only, compared to 7min for version with multiple runners)
  • all features are fully supported (e.g. inline annotations)
  • disable the linter by just adding a build tag in the file is possible in the future
  • the same can be configured in each IDE (by adding to the local linter configuration)
  • locally, if the IDE shows all linter issues, the developer can see it, although the package is disabled by build flag
@gen2thomas gen2thomas force-pushed the feature/linter_add_build_tags branch from 8ea00db to bfc0179 Compare October 22, 2025 14:57
@gen2thomas gen2thomas changed the title fmt: introduce golangci-lint and go vet using build tag Oct 22, 2025
@gen2thomas gen2thomas force-pushed the feature/linter_add_build_tags branch 2 times, most recently from 703ad49 to 43a4b70 Compare October 22, 2025 15:29
@gen2thomas gen2thomas force-pushed the feature/linter_add_build_tags branch from 43a4b70 to 1e2eabe Compare October 22, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant