Changelog of the template repository for Go projects.
Update to tmpl
template repository version 0.11.0
— #91 ⇄ #92 (⊶ ff40ade4)
↠ Updated to tmpl
version 0.11.0
which comes with…
- an opt-in Dependabot version update configuration — this disabled the currently used
.github/dependabot.yml
file in order to remove the PR noise and reduce the maintenance overhead. Dependency updates will be made by keeping up-to-date with newtmpl
repository versions instead which take care of this.
Disable revive linter rule package-comments
— #78 ⇄ #79 (⊶ 918ba3c8)
↠ Even though the package-comments
rule of the revive
linter is quite useful, it produces false-positive errors when another file already has a package documentation. Duplicating documentation is not a workaround so the rule has been disabled for now and might be re-enabled if the rule logic gets updated.
golangci-lint
fails to run due to revive
s unknown time-equal
rule — #76 ⇄ #77 (⊶ ab326723)
↠ The time-equal
rule was added in #64, but the revive
linter used by golangci-lint
does not yet include the rule in the current release version but only merged it into the main
branch. Therefore linting failed because the rule is not known (yet) and golangci-lint
exits before running any linter.
To fix the problem the time-equal
rule has been disabled again for now and will be enabled again when it is available in a new revive
version that is used by golangci-lint
.
Disable golangci-lint
's default excluded issues — #72 ⇄ #73 (⊶ c099c6ee)
↠ By default golangci-lint excludes specific issues (matches) that are known to be "annoying", but this also includes issues explicitly enabled by this template, e.g. the revive rule to check that exported function and methods always have a comment.
To prevent these issues to be found the default excludes will be disables through the issues.exclude-use-default
configuration field.
Cache Go dependencies and build outputs in ci-go
workflow — #74 ⇄ #75 (⊶ 05c0d385)
↠ To improve workflow execution time for the ci-go
workflow the actions/cache
GitHub action is now used to cache Go dependencies and build outputs. Also see the detailed documentation about “Caching dependencies to speed up workflows“ to learn more about the way action/cache
works.
Update to golangci-lint
version 1.43.0
— #64 ⇄ #65 (⊶ 55945b16)
↠ The currently latest golangci-lint
version 1.43.0 introduced new linters and updated supported ones:
- tagliatelle (v1.40.0) — Handles
struct
tags name casing. This linter is disabled by default, but will be enabled for this template to improve consistency across tag names. - errorlint (v1.40.0) — This linter has been disabled in #39 due to prevent false-positive errors, but will be enabled again with the newly introduced
errorf
option being disabled to prevent this from happening again while still taking advantage of theassert
andcomparison
checks. - wrapcheck (v1.40.0) — This linter is known to cause false-positive errors for the main module (
go list -m
) of the repository wheregolangic-lint
is being run, but in version2.3.0
theignorePackageGlobs
option was added that allows to ignore packages by pattern. Therefore in each project the main module should be added as wildcard. Also see tomarrell/wrapcheck#2 for details and discussions about this known problem. - golint (v1.40.1) — Remove deprecated linter. 4.1 The recommended drop-in replacement is revive which is disabled by default, but will be enabled for this template.
- gofumpt (v1.42.0) — Add the
lang-version
with value set to1.17
to target the (currently) latest Go version. - bidichk (v1.43.0) — Checks for dangerous unicode character sequences. This linter is disabled by default, but will be enabled for this template to prevent "trojan source" bugs.
- nilnil (v1.43.0) — Checks that there is no simultaneous return of
nil
error and an invalid value. This linter is disabled by default, but will be enabled for this template to prevent ambiguous returns. - tenv (v1.43.0) — Detects using
os.Setenv
instead oft.Setenv
since Go 1.17. This linter is disabled by default, but will be enabled for this template to prevent errors in tests. - contextcheck (v1.43.0) — Checks if functions whether use a non-inherited context. This linter is disabled by default, but will be enabled for this template to broken call chains and loss of context information.
- lll — Add the
tab-width
option with value set to2
to use two spaces for the width of one tab. - gci — Add the comma-separated list of prefixes for local package imports to be put after 3rd-party packages.
Update Go module to Go 1.17
— #66 ⇄ #67 (⊶ c20ba3bd)
↠ Before the Go module used Go version 1.16
so it has been updated to the currently latest minor version 1.17
.
Optimized GitHub action workflows for Go and Node — #68 ⇄ #69 (⊶ c3ff68b5)
↠ Before all jobs were summarized in the ci
workflow but not separated by their scope, i.e. Go and Node specific tasks. The workflow was also not optimized to only run when specific files have been changed which resulted in false-positive executions and wasted limited free tier and developer time.
Therefore the ci
workflow has been optimized by splitting it into new ci-go
and ci-node
workflows.
The new ci-go
workflow…
- only runs when any
*.go
file has been modified. See the extensive GitHub action documentations abouton.<push|pull_request>.paths
and the filter pattern cheat sheet for more details. - only runs for
ubuntu-latest
instead of a matrix withmacos-latest
andwindows-latest
which should be added for projects with platform specific code.
The new ci-node
workflow…
- only runs when any
*.js
,*.json
,*.md
,*.yaml
and*.yml
file has been modified. This matches the lint-staged, Prettier and remark configurations. See the extensive GitHub action documentations abouton.<push|pull_request>.paths
and the filter pattern cheat sheet for more details. - only runs for
ubuntu-latest
instead of a matrix withmacos-latest
andwindows-latest
which should be added for projects with platform specific code. - uses cache
npm
dependencies which is possible as ofactions/[email protected]
.
When running the configured linting tasks the Prettier CLI prints matches to the standard output with a visual preview of the file content and a marker at the specific element. When files that store secret data, e.g. when encrypted with git-crypt
, are decrypted in the GitHub Actions this could leak this data when Prettier finds errors in these files.
To prevent these case new CI specific linting tasks have been added with a silent
loglevel
. This however comes with the drawback that possible linting errors must be analyzed locally, but the code quality is still ensured by blocking subsequent workflows.
Update to tmpl template repository version 0.10.0
— #70 ⇄ #71 (⊶ 670859ea)
↠ Updated to tmpl
version 0.10.0
which comes with…
- an optimized GitHub action workflow scope — this change has also already been resolved in #68, but additionally created the
ci-go
GitHub Action workflow. - the regular Node package dependency & GitHub action version updates
- the migration to the Markdown style guide version
0.4.0
Update to golangci-lint `v1.39.x
— #56 ⇄ #57 (⊶ 3e60efbc)
↠ golangci-lint
version 1.39.0 introduced new linters and updated supported ones:
- predeclared (v1.35.0) — Checks for definitions and declarations that shadows one of Go's pre-declared identifiers. This linter is disabled by default, but will be enabled for this template to help to prevent shadowed identifiers.
- interfacer (v1.38.0) — Has been deprecated and will be removed from the enabled linter in this template.
- scopelint (v1.39.0) — Has been deprecated and will be replaced by exportloopref.
The
exportloopref
linter is disabled by default, but will be enabled for this template to help to catch loop variable bugs.
Update to tmpl
template repository version 0.9.0
— #58 ⇄ #59 (⊶ 5f0b1cf0)
↠ Updated to tmpl
version 0.9.0
which moves from Yarn back to npm again, improves and clarifies the handling of lockfiles and comes with some major Node package dependency & GitHub action version updates.
Updated to Go 1.16 — #54 ⇄ #55 (⊶ 1f20fe12)
↠ Go 1.16 is finally released so the Go version used for the actions/setup-go
action in the ci
workflow has been updated from 1.15.x
to 1.16.x
and the defined Go version in the go.mod
file bumped to go 1.16
.
Node.js package dependency & GitHub action version updates — #42, #47
↠ Bumped outdated Node.js package dependencies and GitHub actions to their latest versions:
- #48, #52 (⊶ e2487f2b, c13b8122)
actions/setup-node
from v2.1.3 to v2.1.5 - #49 (⊶ 9250ff93)
github.com/stretchr/testify
from v1.6.1 to v1.7.0 - #50, #51, #53 (⊶ bd642b5c, ba39b7e1, f208cdcc)
golangci/golangci-lint-action
from v2 to v2.5.2
Renamed /app
to /apps
— #37 ⇄ #38 (⊶ 5551df2f)
↠ Using the majority apps
as name for the /app
directory conveys a better understanding of the actual use case and makes it more clear that it can contain more than one application in the monorepo layout.
This also aligns with the example in the /web
directory documentation and the Yarn/NPM workspace configuration in the package.json
file where both using the apps
directory.
Disabled errorlint
to prevent false-positive errors — #39 ⇄ #40 (⊶ 28f888a2)
↠ In #21 golangci-lint
was updated to the currently latest version 1.32.0 which introduced the errorlint that has been enabled for this template repository. As it turns out it causes a lot of false-positives errors for code lines that explicitly do not wrap the error to prevent it become part of the public API.
Therefore the linter has been disabled again because the update also introduced the new wrapcheck linter which helps to prevent that errors from external packages are exposed to the public API.
Update to “tmpl“ template repository version 0.8.0 — #45 ⇄ #46 (⊶ 39cf0b85)
↠ Updated to “tmpl“ version 0.8.0 which reduces Dependabot PR noise for the NPM package ecosystem.
Prepared project/repository publication — #35 ⇄ #36 (⊶ 0aec1aef)
↠ Before switching the GitHub repository visibility to “public“ a few adjustments had to be made. Basically #22 was reverted, taking the changes from #23 into account, so that SVG images like the repository hero are using the URLs for public repositories again instead of the ones that allow to resolve the files in private repositories.
Node.js package dependency & GitHub action version updates — #42, #47
↠ Bumped outdated Node.js package dependencies and GitHub actions to their latest versions:
- #42 (⊶ 6e91700f)
prettier
from 2.1.2 to 2.2.1 — The the official Prettier 2.2 introduction blog post for more details. - #47 (⊶ 90c22f24)
actions/setup-node
from v2.1.2 to v2.1.3
Initial project documentation — #31 ⇄ #32 (⊶ d1a77a3d)
↠ Wrote the initial project documentation for the README.md
file that includes…
- …an project introduction and motivation.
- …an overview of the project features.
- …an overview of the directory structure.
- …more detailed sections about all features.
- …some basic instructions how to use this template repository.
- …information about references used for this template repository.
- …information about how to contribute to this project.
Each directory documented in step 3 contains an individual documentation with more detailed information about it.
The package.json
file has also been extended to include the Yarn/NPM workspaces
field.
Update to tmpl
template repository version 0.7.0 — #24, #33 ⇄ #25, #34 (⊶ 793efc26, 81385803)
↠ Updated to tmpl
version 0.7.0 (including version 0.6.0) which introduced a configuration for automated dependency updates and security alerts with Dependabot. Next to the included update configurations for the CI/CD GitHub action workflow and Yarn/NPM dependencies, the file has been extended to support Go modules.
This version also updated to the latest Node.js package dependency & GitHub Action versions.
Update to golangci-lint version 1.32.0 — #20 ⇄ #21 (⊶ 072aad99)
↠ The currently latest golangci-lint
version 1.32.0 introduced new linters that have been configured for this template repository:
- wrapcheck — Checks that errors returned from external packages are wrapped. This linter is disabled by default, but has been enabled for this template repository to help tp reduce error context loss.
- errorlint — Helps to make more efficient use of the error wrapping scheme introduced in Go 1.13. This linter is disabled by default, but has been enabled for this template repository to help to use Go's new error handling concept.
- tparallel — Detects inappropriate usage of
t.Parallel()
method in Go tests. This linter is disabled by default, but has been enabled for this template repository to help to prevent parallelism errors in tests.
Update to "tmpl" template repository version 0.5.0 — #22 ⇄ #23 (⊶ 5da341c3)
↠ Updated to "tmpl" version 0.5.0 which now uses a namespace for the NPM package name that helps to prevent collisions with already existing NPM packages like tmpl.
Go stub package and test — #12 ⇄ #13 (⊶ 66658a15)
↠ To prevent golangci-lint
and the CI workflow test
job from failing a stub file for the tmplgo
package has been added along with a example test (tmplgo_test
package).
This also comes with the benefit of providing a simple starting point for users of this template repository.
Optimize Go version matrix strategy for CI workflow — #16 ⇄ #17 (⊶ bda13d8a)
↠ Before the CI workflow used a matrix strategy to run the lint-go
and test
jobs, but this has been improved to make the workflow run faster by avoiding unnecessary steps:
- The
lint-go
job has been changed to only run on the currently latest stable Go version1.15.x
only on Linux becausegolangci-lint
doesn't care about the Go version and OS it runs on but only statically checks the source code. - The
test
job has been changed to only run on the currently latest stable Go version1.15.x
.
These changes help to keep the required GitHub Action run minutes for the account of this repository as small as possible without wasting resources for unnecessary tasks.
Adapt CI workflow "on" run configurations from "tmpl" template repository — #18 ⇄ #19 (⊶ ec1539cd)
↠ Before the CI workflow only used the push
configuration for the on
field. To improve the performance a more fine grained configuration is now used that has already been defined in the "tmpl" template repository:
- Only runs on pushes to the
main
branch. - Only runs on pushes for
v*
tags. - Always runs for pushes to PRs.
These changes help to keep the required GitHub Action run minutes for the account of this repository as small as possible without wasting resources for unnecessary runs.
Adapt to "tmpl" template repository version 0.4.0 — #14 ⇄ #15 (⊶ 9d50ec0e)
↠ Adapted to "tmpl" version 0.4.0 which includes a optimized OS version matrix strategy for Node based tasks in the CI workflow that helps to keep the required GitHub Action run minutes for the account of this repository as small as possible without wasting resources for unnecessary tasks.
Basic testing in CI workflow — #10 ⇄ #11 (⊶ f65759e6)
↠ Before the CI workflow only ran Node and Go based linters, but doesn't took Go tests into account. This has been changed by adding a new job to run tests with Go's official go test
command with enabled coverage and race detector.
YAML multiline string without "block chomping" for config go-header linter causes golangci-lint to fail — #6 ⇄ #7 (⊶ 910c06ff)
↠ The configuration of the go-header linter is defined in the golangci-lint YAML configuration, but the YAML multiline-string doesn't used "block chomping which resulted in a final newline at the end of the template. This caused golangci-lint to fail because the configured template content doesn't match the parsed text. To fix this problem the YAML block chomping syntax is now used for the multiline-string so that the final newline at the end gets stripped.
Invalid branch & CI workflow name in README badges — #8 ⇄ #9 (⊶ e138ca15)
↠ The name of the branch for the badge URL of the repository changelog was master
instead of main
and the GitHub CI action workflow used the uppercase name CI
instead of ci
.
This is the initial release version of tmpl-go. The basic project setup, structure and development workflow has been bootstrapped by the base tmpl template repository. The additional Go specific initial configurations and documentations are covered in the following sections of this version changelog to introduce used technologies and explain why several decisions have been made.
Bootstrap from "tmpl" base template repository — #1 (⊶ 87400d37)
↠ Bootstrapped the basic project setup, structure and development workflow from version 0.3.0 of the base "tmpl" template repository. Additionally specific assets like the repository hero image were also added.
Go Module — #1 ⇄ #3 (⊶ 52bea37b)
↠ tmpl-go uses the currently latest Go version 1.15.0 with Go Modules and github.com/svengreb/tmpl-go
as module name.
Code quality with "golangci-lint" — #4 ⇄ #5 (⊶ b20e205f)
↠ To ensure a good code quality the Go ecosystem has hundreds of linters, each with a different purpose. Instead of installing and running multiple linters separately golangci-lint provides a uniform interface to run most popular and useful linters in parallel and with many additional configuration features.
The actual runner is open source and can be used locally as well in any private CI/CD pipeline. In order to use it for tmpl-go, a .golangci.yml
configuration file has been added.
The runner is used in the the existing CI GitHub action workflow through the gh-golangci/golangci-lint-action GitHub action that has been created by the golangci-lint maintainers.
Copyright © 2020-present Sven Greb