Releases: svengreb/tmpl-go
0.12.0
Improvements
Update to tmpl
template repository version 0.11.0
— #91 ⇄ #92 (⊶ ff40ade)
↠ 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.
Copyright © 2020-present Sven Greb
0.11.0
Improvements
Disable revive linter rule package-comments
— #78 ⇄ #79 (⊶ 918ba3c)
↠ 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.
Bug Fixes
golangci-lint
fails to run due to revive
s unknown time-equal
rule — #76 ⇄ #77 (⊶ ab32672)
↠ 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
.
The full changelog is available in the repository
Copyright © 2020-present Sven Greb
0.10.0
Improvements
Disable golangci-lint
's default excluded issues — #72 ⇄ #73 (⊶ c099c6e)
↠ 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 (⊶ 05c0d38)
↠ 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.
The full changelog is available in the repository
Copyright © 2020-present Sven Greb
0.9.0
Improvements
Update to golangci-lint
version 1.43.0
— #64 ⇄ #65 (⊶ 55945b1)
↠ 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 (⊶ c20ba3b)
↠ 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 (⊶ c3ff68b)
↠ 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.
CI Go
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.
CI Node
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/setup-node@v2.2.0
.
Silent linting errors for CI/CD environments
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 (⊶ 670859e)
↠ 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
The full changelog is available in the repository
Copyright © 2019-present Sven Greb
0.8.0
Improvements
Update to golangci-lint v1.39.x
— #56 ⇄ #57 (⊶ 3e60efb)
↠ 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.
Theexportloopref
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 (⊶ 5f0b1cf)
↠ 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.
The full changelog is available in the repository
Copyright © 2019-present Sven Greb
0.7.0
Improvements
Updated to Go 1.16 — #54 ⇄ #55 (⊶ 1f20fe1)
↠ 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
.
Tasks
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 (⊶ e2487f2, c13b812)
actions/setup-node
from v2.1.3 to v2.1.5 - #49 (⊶ 9250ff9)
github.com/stretchr/testify
from v1.6.1 to v1.7.0 - #50, #51, #53 (⊶ bd642b5, ba39b7e, f208cdc)
golangci/golangci-lint-action
from v2 to v2.5.2
The full changelog is available in the repository
Copyright © 2019-present Sven Greb
0.6.0
Improvements
Renamed /app
to /apps
— #37 ⇄ #38 (⊶ 5551df2)
↠ 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 (⊶ 28f888a)
↠ 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 (⊶ 39cf0b8)
↠ Updated to “tmpl“ version 0.8.0 which reduces Dependabot PR noise for the NPM package ecosystem.
Tasks
Prepared project/repository publication — #35 ⇄ #36 (⊶ 0aec1ae)
↠ 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 (⊶ 6e91700)
prettier
from 2.1.2 to 2.2.1 — The the official Prettier 2.2 introduction blog post for more details. - #47 (⊶ 90c22f2)
actions/setup-node
from v2.1.2 to v2.1.3
The full changelog is available in the repository
Copyright © 2019-present Sven Greb
0.5.0
Features
Initial project documentation — #31 ⇄ #32 (⊶ d1a77a3)
↠ 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 (⊶ 793efc2, 8138580)
↠ 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.
The full changelog is available here
v0.4.0
Features
Update to golangci-lint version 1.32.0 — #20 ⇄ #21 (⊶ 072aad9)
↠ 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 (⊶ 5da341c)
↠ 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.
The full changelog is available here
0.3.0
Features
Go stub package and test — #12 ⇄ #13 (⊶ 66658a1)
↠ 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.
Improvements
Optimize Go version matrix strategy for CI workflow — #16 ⇄ #17 (⊶ bda13d8)
↠ 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 (⊶ ec1539c)
↠ 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.
Tasks
Adapt to "tmpl" template repository version 0.4.0 — #14 ⇄ #15 (⊶ 9d50ec0)
↠ 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.
The full changelog is available here