diff --git a/CHANGELOG.md b/CHANGELOG.md index e42c993..c55d879 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,28 +1,107 @@

-

+

-

Changelog of the template repository for Go projects.

+

Changelog of the template repository for Go projects.

+# 0.9.0 + +![Release Date: 2021-11-20](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2021-11-20&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.9.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/13) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.8.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/10) + +⇅ [Show all commits][104] + +## Improvements + +
+Update to golangci-lint version 1.43.0 — #64 ⇄ #65 (⊶ 55945b16) + +↠ The currently latest [`golangci-lint` version 1.43.0][78] introduced new linters and updated supported ones: + +1. [tagliatelle][68] ([v1.40.0][69]) — Handles `struct` tags name casing. + This linter is **disabled by default**, but will be **enabled** for this template to improve consistency across tag names. +2. [errorlint][1] ([v1.40.0][69]) — This linter has been disabled in #39 due to prevent false-positive errors, but will be **enabled** again with the newly introduced [`errorf` option][71] being disabled to prevent this from happening again while still taking advantage of the `assert` and `comparison` checks. +3. [wrapcheck][2] ([v1.40.0][69]) — This linter is known to cause false-positive errors for the main module (`go list -m`) of the repository where `golangic-lint` is being run, but in [version `2.3.0`][73] the `ignorePackageGlobs` 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][74] for details and discussions about this known problem. +4. [golint][75] ([v1.40.1][76]) — Remove deprecated linter. + 4.1 The recommended drop-in replacement is [revive][87] which is **disabled by default**, but will be **enabled** for this template. +5. [gofumpt][83] ([v1.42.0][82]) — Add the `lang-version` with value set to `1.17` to target the (currently) latest Go version. +6. [bidichk][77] ([v1.43.0][78]) — Checks for dangerous unicode character sequences. + This linter is **disabled by default**, but will be **enabled** for this template to prevent "trojan source" bugs. +7. [nilnil][79] ([v1.43.0][78]) — 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. +8. [tenv][80] ([v1.43.0][78]) — Detects using `os.Setenv` instead of `t.Setenv` since Go 1.17. + This linter is **disabled by default**, but will be **enabled** for this template to prevent errors in tests. +9. [contextcheck][81] ([v1.43.0][78]) — 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. +10. [lll][84] — Add the `tab-width` option with value set to `2` to use two spaces for the width of one tab. +11. [gci][85] — Add the comma-separated [list of prefixes for local package imports][86] to be put after 3rd-party packages. + +
+ +
+Update Go module to Go 1.17 — #66 ⇄ #67 (⊶ c20ba3bd) + +↠ Before the [Go module][88] used Go version `1.16` so it has been updated to the [currently latest minor version `1.17`][89]. + +
+ +
+Optimized GitHub action workflows for Go and Node — #68 ⇄ #69 (⊶ c3ff68b5) + +↠ Before all jobs were summarized in the [`ci` workflow][90] 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 about `on..paths`][93] and the [filter pattern cheat sheet][94] for more details. +- only runs for `ubuntu-latest` instead of a matrix with `macos-latest` and `windows-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][91], Prettier and remark configurations. See the extensive [GitHub action documentations about `on..paths`][93] and the [filter pattern cheat sheet][94] for more details. +- only runs for `ubuntu-latest` instead of a matrix with `macos-latest` and `windows-latest` which should be added for projects with platform specific code. +- uses cache `npm` dependencies which is [possible as of `actions/setup-node@v2.2.0`][92]. + +## Silent linting errors for CI/CD environments + +When running the [configured linting tasks][95] the [Prettier CLI][96] 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`][97], are [decrypted in the GitHub Actions][98] 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`][99]. 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`][100] which comes with… + +1. [an optimized GitHub action workflow scope][101] — this change has also already been resolved in #68, but additionally created the `ci-go` GitHub Action workflow. +2. [the regular Node package dependency & GitHub action version updates][102] +3. [the migration to the Markdown style guide version `0.4.0`][103] + +
+ # 0.8.0 ![Release Date: 2021-04-27](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2021-04-27&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.8.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/12) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.8.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/9) -⇅ [Show all commits][gh-compare-tag-v0.7.0_v0.8.0] +⇅ [Show all commits][54] ## Improvements
-Update to golangci-lint `v1.39.x — #56 ⇄ #57 (⊶ 3e60efbc) +Update to golangci-lint `v1.39.x — #56 ⇄ #57 (⊶ 3e60efbc) -↠ [`golangci-lint` version 1.39.0][gh-golangci/golangci-lint-rln-v1.39.0] introduced new linters and updated supported ones: +↠ [`golangci-lint` version 1.39.0][57] introduced new linters and updated supported ones: -1. [predeclared][gh-nishanths/predeclared] ([v1.35.0][gh-golangci/golangci-lint-rln-v1.35.0]) — Checks for definitions and declarations that shadows one of [Go's pre-declared identifiers][go-docs-spec#predeclared_identifiers]. +1. [predeclared][63] ([v1.35.0][55]) — Checks for definitions and declarations that shadows one of [Go's pre-declared identifiers][67]. This linter is **disabled by default**, but will be **enabled** for this template to help to prevent shadowed identifiers. -2. [interfacer][gh-mvdan/interfacer] ([v1.38.0][gh-golangci/golangci-lint-rln-v1.38.0]) — [Has been deprecated][gh-golangci/golangci-lint#1755] and will be removed from the enabled linter in this template. -3. [scopelint][gh-kyoh86/scopelint] ([v1.39.0][gh-golangci/golangci-lint-rln-v1.39.0]) — [Has been deprecated][gh-golangci/golangci-lint#1819] and will be replaced by [exportloopref][gh-kyoh86/exportloopref]. +2. [interfacer][62] ([v1.38.0][56]) — [Has been deprecated][58] and will be removed from the enabled linter in this template. +3. [scopelint][61] ([v1.39.0][57]) — [Has been deprecated][59] and will be replaced by [exportloopref][60]. The `exportloopref` linter is **disabled by default**, but will be **enabled** for this template to help to catch loop variable bugs.
@@ -30,7 +109,7 @@
Update to tmpl template repository version 0.9.0 — #58 ⇄ #59 (⊶ 5f0b1cf0) -↠ Updated to [`tmpl` version `0.9.0`][gh-svengreb/tmpl-rl-v0.9.0] which [moves from Yarn back to npm again][gh-svengreb/tmpl#72], [improves and clarifies the handling of lockfiles][gh-svengreb/tmpl#70] and comes with some major Node package dependency & GitHub action version updates. +↠ Updated to [`tmpl` version `0.9.0`][64] which [moves from Yarn back to npm again][66], [improves and clarifies the handling of lockfiles][65] and comes with some major Node package dependency & GitHub action version updates.
@@ -38,14 +117,14 @@ ![Release Date: 2021-04-21](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2021-04-21&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.7.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/11) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.7.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/8) -⇅ [Show all commits][gh-compare-tag-v0.6.0_v0.7.0] +⇅ [Show all commits][49] ## Improvements
Updated to Go 1.16 — #54 ⇄ #55 (⊶ 1f20fe12) -↠ [Go 1.16][go-docs-rln-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`. +↠ [Go 1.16][53] 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`.
@@ -56,9 +135,9 @@ ↠ Bumped outdated Node.js package dependencies and GitHub actions to their latest versions: -- #48, #52 (⊶ e2487f2b, c13b8122) [`actions/setup-node`][gh-actions/setup-node] from [v2.1.3 to v2.1.5][gh-actions/setup-node-comp-v2.1.3_v2.1.5] -- #49 (⊶ 9250ff93) [`github.com/stretchr/testify`][gh-stretchr/testify] from [v1.6.1 to v1.7.0][gh-stretchr/testify-comp-v1.6.1_v1.7.0] -- #50, #51, #53 (⊶ bd642b5c, ba39b7e1, f208cdcc) [`golangci/golangci-lint-action`][gh-golangci/golangci-lint-action] from [v2 to v2.5.2][gh-golangci/golangci-lint-action-comp-v2_v2.5.2] +- #48, #52 (⊶ e2487f2b, c13b8122) [`actions/setup-node`][36] from [v2.1.3 to v2.1.5][48] +- #49 (⊶ 9250ff93) [`github.com/stretchr/testify`][52] from [v1.6.1 to v1.7.0][51] +- #50, #51, #53 (⊶ bd642b5c, ba39b7e1, f208cdcc) [`golangci/golangci-lint-action`][6] from [v2 to v2.5.2][50] @@ -66,30 +145,30 @@ ![Release Date: 2020-12-12](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2020-12-12&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.6.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/10) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.6.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/7) -⇅ [Show all commits][gh-compare-tag-v0.5.0_v0.6.0] +⇅ [Show all commits][38] ## Improvements
Renamed /app to /apps — #37 ⇄ #38 (⊶ 5551df2f) -↠ Using the majority `apps` as name for the [`/app` directory][gh-tree-app] 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][trunkbasedev-monorepos] layout. -This also aligns with the [example in the `/web` directory documentation][gh-tree-web#example] and the Yarn/NPM [workspace configuration in the `package.json` file][gh-blob-package.json#l24] where both using the `apps` directory. +↠ Using the majority `apps` as name for the [`/app` directory][44] 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][47] layout. +This also aligns with the [example in the `/web` directory documentation][45] and the Yarn/NPM [workspace configuration in the `package.json` file][37] 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][gh-golangci/golangci-lint-rl-v1.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. +↠ In #21 `golangci-lint` was updated to the [currently latest version 1.32.0][9] which introduced the [errorlint][1] 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][2] 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][gh-svengreb/tmpl-rl-v0.8.0] which [reduces _Dependabot_ PR noise for the NPM package ecosystem][gh-svengreb/tmpl#65]. +↠ Updated to [“tmpl“ version 0.8.0][42] which [reduces _Dependabot_ PR noise for the NPM package ecosystem][43].
@@ -98,7 +177,7 @@ Therefore the linter has been disabled again because the update also introduced
Prepared project/repository publication — #35 ⇄ #36 (⊶ 0aec1aef) -↠ Before switching the [GitHub repository visibility][gh-docs-repo_vis] to “public“ a few adjustments had to be made. +↠ Before switching the [GitHub repository visibility][39] 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.
@@ -108,8 +187,8 @@ Basically #22 was reverted, taking the changes from #23 into account, so that SV ↠ Bumped outdated Node.js package dependencies and GitHub actions to their latest versions: -- #42 (⊶ 6e91700f) [`prettier`][gh-prettier/prettier] from [2.1.2 to 2.2.1][gh-prettier/prettier-comp-v2.1.2_v2.2.1] — The the [official Prettier 2.2 introduction blog post][prettier-blog-rl_2.2] for more details. -- #47 (⊶ 90c22f24) [`actions/setup-node`][gh-actions/setup-node] from [v2.1.2 to v2.1.3][gh-actions/setup-node-comp-v2.1.2_27082cec] +- #42 (⊶ 6e91700f) [`prettier`][41] from [2.1.2 to 2.2.1][40] — The the [official Prettier 2.2 introduction blog post][46] for more details. +- #47 (⊶ 90c22f24) [`actions/setup-node`][36] from [v2.1.2 to v2.1.3][35] @@ -117,7 +196,7 @@ Basically #22 was reverted, taking the changes from #23 into account, so that SV ![Release Date: 2020-11-10](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2020-11-10&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.5.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/9) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.5.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/6) -⇅ [Show all commits][gh-compare-tag-v0.4.0_v0.5.0] +⇅ [Show all commits][26] ## Features @@ -135,14 +214,14 @@ Basically #22 was reverted, taking the changes from #23 into account, so that SV 7. …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][yarn-docs-ws]/[NPM][npm-docs-cli-v7-ws] `workspaces` field. +The `package.json` file has also been extended to include the [Yarn][34]/[NPM][30] `workspaces` field.
Update to tmpl template repository version 0.7.0 — #24, #33 ⇄ #25, #34 (⊶ 793efc26, 81385803) -↠ Updated to [`tmpl` version 0.7.0][gh-tmpl-rel-v0.7.0] (including version [0.6.0][gh-tmpl-rel-v0.6.0]) which introduced a configuration for [automated dependency updates and security alerts][svengreb/tmpl#52] with [Dependabot][]. Next to the included update configurations for the [CI/CD GitHub action workflow][tmpl#cicd] and [Yarn/NPM dependencies][tmpl#node], the file has been extended to support [Go modules][go-doc-mod]. +↠ Updated to [`tmpl` version 0.7.0][28] (including version [0.6.0][27]) which introduced a configuration for [automated dependency updates and security alerts][31] with [Dependabot][7]. Next to the included update configurations for the [CI/CD GitHub action workflow][32] and [Yarn/NPM dependencies][33], the file has been extended to support [Go modules][29]. This version also updated to the latest Node.js package dependency & GitHub Action versions.
@@ -151,20 +230,20 @@ This version also updated to the latest Node.js package dependency & GitHub Acti ![Release Date: 2020-10-31](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2020-10-31&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.4.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/8) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.4.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/5) -⇅ [Show all commits][gh-compare-tag-v0.3.0_v0.4.0] +⇅ [Show all commits][22] ## Features
Update to golangci-lint version 1.32.0 — #20 ⇄ #21 (⊶ 072aad99) -↠ The currently latest [`golangci-lint` version 1.32.0][gh-golangci/golangci-lint-rl-v1.32.0] introduced new linters that have been configured for this template repository: +↠ The currently latest [`golangci-lint` version 1.32.0][9] introduced new linters that have been configured for this template repository: -1. [wrapcheck][] — Checks that errors returned from external packages are wrapped. +1. [wrapcheck][2] — 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. -2. [errorlint][] — Helps to make more efficient use of the error wrapping scheme introduced in Go 1.13. +2. [errorlint][1] — 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. -3. [tparallel][] — Detects inappropriate usage of `t.Parallel()` method in Go tests. +3. [tparallel][5] — 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.
@@ -172,7 +251,7 @@ This version also updated to the latest Node.js package dependency & GitHub Acti
Update to "tmpl" template repository version 0.5.0 — #22 ⇄ #23 (⊶ 5da341c3) -↠ Updated to ["tmpl" version 0.5.0][gh-tmpl-rel-v0.5.0] which now uses a [namespace for the NPM package name][svengreb/tmpl#48] that helps to prevent collisions with already existing NPM packages like [tmpl][npm-tmpl]. +↠ Updated to ["tmpl" version 0.5.0][23] which now uses a [namespace for the NPM package name][25] that helps to prevent collisions with already existing NPM packages like [tmpl][24].
@@ -180,7 +259,7 @@ This version also updated to the latest Node.js package dependency & GitHub Acti ![Release Date: 2020-09-25](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2020-09-25&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.3.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/7) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.3.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/4) -⇅ [Show all commits][gh-compare-tag-v0.2.0_v0.3.0] +⇅ [Show all commits][20] ## Features @@ -199,8 +278,8 @@ This also comes with the benefit of providing a simple starting point for users ↠ 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 version `1.15.x`][go-rln-1.15.0] only on _Linux_ because `golangci-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 version `1.15.x`][go-rln-1.15.0]. +- The `lint-go` job has been changed to only run on the [currently latest stable Go version `1.15.x`][10] only on _Linux_ because `golangci-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 version `1.15.x`][10]. 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. @@ -209,7 +288,7 @@ These changes help to keep the required GitHub Action run minutes for the accoun
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][gh-tmpl]: +↠ 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][8]: - Only runs on pushes to the `main` branch. - Only runs on pushes for `v*` tags. @@ -224,7 +303,7 @@ These changes help to keep the required GitHub Action run minutes for the accoun
Adapt to "tmpl" template repository version 0.4.0 — #14 ⇄ #15 (⊶ 9d50ec0e) -↠ Adapted to ["tmpl" version 0.4.0][gh-tmpl-rel-v0.4.0] which includes a [optimized OS version matrix strategy for Node based tasks in the CI workflow][svengreb/tmpl#46] 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. +↠ Adapted to ["tmpl" version 0.4.0][19] which includes a [optimized OS version matrix strategy for Node based tasks in the CI workflow][21] 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.
@@ -232,7 +311,7 @@ These changes help to keep the required GitHub Action run minutes for the accoun ![Release Date: 2020-09-24](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2020-09-24&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.2.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/6) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.2.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/3) -⇅ [Show all commits][gh-compare-tag-v0.1.0_v0.2.0] +⇅ [Show all commits][18] ## Features @@ -247,14 +326,14 @@ These changes help to keep the required GitHub Action run minutes for the accoun ![Release Date: 2020-09-21](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2020-09-21&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.1.1&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/5) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.1.1&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/2) -⇅ [Show all commits][gh-compare-tag-v0.1.0_v0.1.1] +⇅ [Show all commits][15] ## Bug Fixes
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][yaml-multiline] doesn't used ["block chomping][yaml-spec-1.2#block_chomping] which resulted in a final newline at the end of the template. +↠ The configuration of the [go-header][4] linter is defined in the [golangci-lint][3] YAML configuration, but the [YAML multiline-string][16] doesn't used ["block chomping][17] 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. @@ -271,10 +350,10 @@ To fix this problem the YAML _block chomping_ syntax is now used for the multili ![Release Date: 2020-09-20](https://img.shields.io/static/v1?style=flat-square&label=Release%20Date&message=2020-09-20&colorA=4c566a&colorB=88c0d0) [![Project Board](https://img.shields.io/static/v1?style=flat-square&label=Project%20Board&message=0.1.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/projects/4) [![Milestone](https://img.shields.io/static/v1?style=flat-square&label=Milestone&message=0.1.0&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0)](https://github.com/svengreb/tmpl-go/milestone/1) -⇅ [Show all commits][gh-compare-tag-init_v0.1.0] +⇅ [Show all commits][14] 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][gh-tmpl]. +The basic project setup, structure and development workflow has been bootstrapped by [the base _tmpl_ template repository][8]. 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. ## Features @@ -284,7 +363,7 @@ The additional Go specific initial configurations and documentations are covered

-↠ Bootstrapped the basic project setup, structure and development workflow [from version 0.3.0][gh-tmpl-release-v0.3.0] of the [base "tmpl" template repository][gh-tmpl]. +↠ Bootstrapped the basic project setup, structure and development workflow [from version 0.3.0][12] of the [base "tmpl" template repository][8]. Additionally specific assets like the repository hero image were also added.
@@ -292,17 +371,17 @@ 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][go-rln-1.15.0] with [Go Modules][gh-go-wiki-modules] and `github.com/svengreb/tmpl-go` as module name. +↠ tmpl-go uses the currently latest Go version [1.15.0][10] with [Go Modules][11] 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. +↠ 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][3] 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][repo-action-query-ci] through the [gh-golangci/golangci-lint-action][] GitHub action that has been created by the golangci-lint maintainers. +The runner is used in the [the existing _CI_ GitHub action workflow][13] through the [gh-golangci/golangci-lint-action][6] GitHub action that has been created by the golangci-lint maintainers.
@@ -328,100 +407,138 @@ otherwise Markdown elements are not parsed and rendered! -[errorlint]: https://github.com/polyfloyd/go-errorlint -[gh-golangci/golangci-lint-action]: https://github.com/golangci/golangci-lint-action -[gh-tmpl]: https://github.com/svengreb/tmpl -[golangci-lint]: https://golangci-lint.run -[wrapcheck]: https://github.com/tomarrell/wrapcheck +[1]: https://github.com/polyfloyd/go-errorlint +[2]: https://github.com/tomarrell/wrapcheck +[3]: https://golangci-lint.run +[6]: https://github.com/golangci/golangci-lint-action +[8]: https://github.com/svengreb/tmpl -[gh-golangci/golangci-lint-rl-v1.32.0]: https://github.com/golangci/golangci-lint/releases/tag/v1.32.0 -[go-rln-1.15.0]: https://golang.org/doc/go1.15 +[9]: https://github.com/golangci/golangci-lint/releases/tag/v1.32.0 +[10]: https://golang.org/doc/go1.15 -[gh-go-wiki-modules]: https://github.com/golang/go/wiki/Modules -[gh-tmpl-release-v0.3.0]: https://github.com/svengreb/tmpl/releases/tag/v0.3.0 -[repo-action-query-ci]: https://github.com/svengreb/tmpl-go/actions?query=workflow%3ACI -[gh-compare-tag-init_v0.1.0]: https://github.com/svengreb/tmpl-go/compare/87400d37...v0.1.0 +[11]: https://github.com/golang/go/wiki/Modules +[12]: https://github.com/svengreb/tmpl/releases/tag/v0.3.0 +[13]: https://github.com/svengreb/tmpl-go/actions?query=workflow%3ACI +[14]: https://github.com/svengreb/tmpl-go/compare/87400d37...v0.1.0 -[go-header]: https://github.com/denis-tingajkin/go-header -[gh-compare-tag-v0.1.0_v0.1.1]: https://github.com/svengreb/tmpl-go/compare/v0.1.0...v0.1.1 -[yaml-multiline]: https://yaml-multiline.info -[yaml-spec-1.2#block_chomping]: https://yaml.org/spec/1.2/spec.html#id2794534 +[4]: https://github.com/denis-tingajkin/go-header +[15]: https://github.com/svengreb/tmpl-go/compare/v0.1.0...v0.1.1 +[16]: https://yaml-multiline.info +[17]: https://yaml.org/spec/1.2/spec.html#id2794534 -[gh-compare-tag-v0.1.0_v0.2.0]: https://github.com/svengreb/tmpl-go/compare/v0.1.1...v0.2.0 +[18]: https://github.com/svengreb/tmpl-go/compare/v0.1.1...v0.2.0 -[gh-tmpl-rel-v0.4.0]: https://github.com/svengreb/tmpl/releases/tag/v0.4.0 -[gh-compare-tag-v0.2.0_v0.3.0]: https://github.com/svengreb/tmpl-go/compare/v0.2.0...v0.3.0 -[svengreb/tmpl#46]: https://github.com/svengreb/tmpl/issues/46 +[19]: https://github.com/svengreb/tmpl/releases/tag/v0.4.0 +[20]: https://github.com/svengreb/tmpl-go/compare/v0.2.0...v0.3.0 +[21]: https://github.com/svengreb/tmpl/issues/46 -[gh-compare-tag-v0.3.0_v0.4.0]: https://github.com/svengreb/tmpl-go/compare/v0.3.0...v0.4.0 -[gh-tmpl-rel-v0.5.0]: https://github.com/svengreb/tmpl/releases/tag/v0.5.0 -[npm-tmpl]: https://www.npmjs.com/package/tmpl -[svengreb/tmpl#48]: https://github.com/svengreb/tmpl/issues/48 -[tparallel]: https://github.com/moricho/tparallel +[22]: https://github.com/svengreb/tmpl-go/compare/v0.3.0...v0.4.0 +[23]: https://github.com/svengreb/tmpl/releases/tag/v0.5.0 +[24]: https://www.npmjs.com/package/tmpl +[25]: https://github.com/svengreb/tmpl/issues/48 +[5]: https://github.com/moricho/tparallel -[dependabot]: https://dependabot.com -[gh-compare-tag-v0.4.0_v0.5.0]: https://github.com/svengreb/tmpl-go/compare/v0.4.0...v0.5.0 -[gh-tmpl-rel-v0.6.0]: https://github.com/svengreb/tmpl/releases/tag/v0.6.0 -[gh-tmpl-rel-v0.7.0]: https://github.com/svengreb/tmpl/releases/tag/v0.7.0 -[go-doc-mod]: https://golang.org/ref/mod -[npm-docs-cli-v7-ws]: https://docs.npmjs.com/cli/v7/using-npm/workspaces -[svengreb/tmpl#52]: https://github.com/svengreb/tmpl/issues/52 -[tmpl#cicd]: https://github.com/svengreb/tmpl#cicd-action-workflow -[tmpl#node]: https://github.com/svengreb/tmpl#nodejs-yarn-and-npm -[yarn-docs-ws]: https://classic.yarnpkg.com/docs/workspaces +[7]: https://dependabot.com +[26]: https://github.com/svengreb/tmpl-go/compare/v0.4.0...v0.5.0 +[27]: https://github.com/svengreb/tmpl/releases/tag/v0.6.0 +[28]: https://github.com/svengreb/tmpl/releases/tag/v0.7.0 +[29]: https://golang.org/ref/mod +[30]: https://docs.npmjs.com/cli/v7/using-npm/workspaces +[31]: https://github.com/svengreb/tmpl/issues/52 +[32]: https://github.com/svengreb/tmpl#cicd-action-workflow +[33]: https://github.com/svengreb/tmpl#nodejs-yarn-and-npm +[34]: https://classic.yarnpkg.com/docs/workspaces -[gh-actions/setup-node-comp-v2.1.2_27082cec]: https://github.com/actions/setup-node/compare/v2.1.2...27082cecf3ff7a1742dbd5e12605f0cb59dce2d9 -[gh-actions/setup-node]: https://github.com/actions/setup-node -[gh-blob-package.json#l24]: https://github.com/svengreb/tmpl-go/blob/main/package.json#L24 -[gh-compare-tag-v0.5.0_v0.6.0]: https://github.com/svengreb/tmpl-go/compare/v0.5.0...v0.6.0 -[gh-docs-repo_vis]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/setting-repository-visibility -[gh-prettier/prettier-comp-v2.1.2_v2.2.1]: https://github.com/prettier/prettier/compare/2.1.2...2.2.1 -[gh-prettier/prettier]: https://github.com/prettier/prettier -[gh-svengreb/tmpl-rl-v0.8.0]: https://github.com/svengreb/tmpl/releases/tag/v0.8.0 -[gh-svengreb/tmpl#65]: https://github.com/svengreb/tmpl/issues/65 -[gh-tree-app]: https://github.com/svengreb/tmpl-go/tree/main/app -[gh-tree-web#example]: https://github.com/svengreb/tmpl-go/tree/main/web#example -[prettier-blog-rl_2.2]: https://prettier.io/blog/2020/11/20/2.2.0.html -[trunkbasedev-monorepos]: https://trunkbaseddevelopment.com/monorepos +[35]: https://github.com/actions/setup-node/compare/v2.1.2...27082cecf3ff7a1742dbd5e12605f0cb59dce2d9 +[36]: https://github.com/actions/setup-node +[37]: https://github.com/svengreb/tmpl-go/blob/main/package.json#L24 +[38]: https://github.com/svengreb/tmpl-go/compare/v0.5.0...v0.6.0 +[39]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/setting-repository-visibility +[40]: https://github.com/prettier/prettier/compare/2.1.2...2.2.1 +[41]: https://github.com/prettier/prettier +[42]: https://github.com/svengreb/tmpl/releases/tag/v0.8.0 +[43]: https://github.com/svengreb/tmpl/issues/65 +[44]: https://github.com/svengreb/tmpl-go/tree/main/app +[45]: https://github.com/svengreb/tmpl-go/tree/main/web#example +[46]: https://prettier.io/blog/2020/11/20/2.2.0.html +[47]: https://trunkbaseddevelopment.com/monorepos -[gh-actions/setup-node-comp-v2.1.3_v2.1.5]: https://github.com/actions/setup-node/compare/v2.1.3...v2.1.5 -[gh-compare-tag-v0.6.0_v0.7.0]: https://github.com/svengreb/tmpl-go/compare/v0.6.0...v0.7.0 -[gh-golangci/golangci-lint-action-comp-v2_v2.5.2]: https://github.com/golangci/golangci-lint-action/compare/v2...v2.5.2 -[gh-stretchr/testify-comp-v1.6.1_v1.7.0]: https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0 -[gh-stretchr/testify]: https://github.com/stretchr/testify -[go-docs-rln-1.16]: https://golang.org/doc/go1.16 +[48]: https://github.com/actions/setup-node/compare/v2.1.3...v2.1.5 +[49]: https://github.com/svengreb/tmpl-go/compare/v0.6.0...v0.7.0 +[50]: https://github.com/golangci/golangci-lint-action/compare/v2...v2.5.2 +[51]: https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0 +[52]: https://github.com/stretchr/testify +[53]: https://golang.org/doc/go1.16 -[gh-compare-tag-v0.7.0_v0.8.0]: https://github.com/svengreb/tmpl-go/compare/v0.7.0...v0.8.0 -[gh-golangci/golangci-lint-rln-v1.35.0]: https://github.com/golangci/golangci-lint/releases/tag/v1.35.0 -[gh-golangci/golangci-lint-rln-v1.38.0]: https://github.com/golangci/golangci-lint/releases/tag/v1.38.0 -[gh-golangci/golangci-lint-rln-v1.39.0]: https://github.com/golangci/golangci-lint/releases/tag/v1.39.0 -[gh-golangci/golangci-lint#1755]: https://github.com/golangci/golangci-lint/pull/1755 -[gh-golangci/golangci-lint#1819]: https://github.com/golangci/golangci-lint/pull/1819 -[gh-kyoh86/exportloopref]: https://github.com/kyoh86/exportloopref -[gh-kyoh86/scopelint]: https://github.com/kyoh86/scopelint -[gh-mvdan/interfacer]: https://github.com/mvdan/interfacer -[gh-nishanths/predeclared]: https://github.com/nishanths/predeclared -[gh-svengreb/tmpl-rl-v0.9.0]: https://github.com/svengreb/tmpl/releases/tag/v0.9.0 -[gh-svengreb/tmpl#70]: https://github.com/svengreb/tmpl/issues/70 -[gh-svengreb/tmpl#72]: https://github.com/svengreb/tmpl/issues/72 -[go-docs-spec#predeclared_identifiers]: https://golang.org/ref/spec#Predeclared_identifiers +[54]: https://github.com/svengreb/tmpl-go/compare/v0.7.0...v0.8.0 +[55]: https://github.com/golangci/golangci-lint/releases/tag/v1.35.0 +[56]: https://github.com/golangci/golangci-lint/releases/tag/v1.38.0 +[57]: https://github.com/golangci/golangci-lint/releases/tag/v1.39.0 +[58]: https://github.com/golangci/golangci-lint/pull/1755 +[59]: https://github.com/golangci/golangci-lint/pull/1819 +[60]: https://github.com/kyoh86/exportloopref +[61]: https://github.com/kyoh86/scopelint +[62]: https://github.com/mvdan/interfacer +[63]: https://github.com/nishanths/predeclared +[64]: https://github.com/svengreb/tmpl/releases/tag/v0.9.0 +[65]: https://github.com/svengreb/tmpl/issues/70 +[66]: https://github.com/svengreb/tmpl/issues/72 +[67]: https://golang.org/ref/spec#Predeclared_identifiers + + + +[68]: https://github.com/ldez/tagliatelle +[69]: https://github.com/golangci/golangci-lint/releases/tag/v1.40.0 +[71]: https://golangci-lint.run/usage/linters/#errorlint +[73]: https://github.com/tomarrell/wrapcheck/releases/tag/v2.3.0 +[74]: https://github.com/tomarrell/wrapcheck/issues/2 +[75]: https://github.com/golang/lint +[76]: https://github.com/golangci/golangci-lint/releases/tag/v1.40.1 +[77]: https://github.com/breml/bidichk +[78]: https://github.com/golangci/golangci-lint/releases/tag/v1.43.0 +[79]: https://github.com/Antonboom/nilnil +[80]: https://github.com/sivchari/tenv +[81]: https://github.com/sylvia7788/contextcheck +[82]: https://github.com/golangci/golangci-lint/releases/tag/v1.42.0 +[83]: https://github.com/mvdan/gofumpt +[84]: https://github.com/walle/lll +[85]: https://github.com/daixiang0/gci +[86]: https://golangci-lint.run/usage/linters/#gci +[87]: https://github.com/mgechev/revive +[88]: https://github.com/svengreb/tmpl-go/blob/97fdc142/go.mod +[89]: https://golang.org/doc/go1.17 +[90]: https://github.com/svengreb/tmpl-go/blob/c20ba3bd/.github/workflows/ci.yml +[91]: https://github.com/svengreb/tmpl-go/blob/c20ba3bd/lint-staged.config.js#L12 +[92]: https://github.com/actions/setup-node/releases/tag/v2.2.0 +[93]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths +[94]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet +[95]: https://github.com/svengreb/tmpl-go/blob/c20ba3bd/package.json#L28 +[96]: https://prettier.io/docs/en/cli.html +[97]: https://github.com/svengreb/antarctica/issues/170 +[98]: https://github.com/svengreb/antarctica/blob/0e6abe44/.github/workflows/ci-go.yaml#L29-L32 +[99]: https://prettier.io/docs/en/cli.html#--loglevel +[100]: https://github.com/svengreb/tmpl/releases/tag/v0.10.0 +[101]: https://github.com/svengreb/tmpl/issues/84 +[102]: https://github.com/svengreb/tmpl/issues/86 +[103]: https://github.com/svengreb/tmpl/issues/76 +[104]: https://github.com/svengreb/tmpl-go/compare/v0.8.0...v0.9.0 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 6ddb1cf..3ccac6e 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -2,7 +2,7 @@ All (core) team members, contributors/committers and volunteers in this project are required to act according to the following Code of Conduct. We ask you to follow these guidelines which help steer our interactions and strive to keep this a positive and growing project and help us provide and ensure a safe environment for everyone. -If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact me at support@svengreb.de or directly to one of the core team members via [email][mailmap]. Your reports will be taken seriously and not dismissed or argued with. +If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact me at support@svengreb.de or directly to one of the core team members via [email][3]. Your reports will be taken seriously and not dismissed or argued with. ## What we believe in and how we act @@ -13,7 +13,7 @@ If you are being harassed, notice that someone else is being harassed, or have a - We are focusing on what is best for the community. - We are respectful of others, their positions, their skills, their commitments and their efforts. - We are attentive in our communications, whether in person or online, and we are tactful and respectful when approaching differing views and experiences. -- We are aware that language shapes reality. Thus, we use inclusive, gender-neutral language in the documents we provide and when we talk to people. When referring to a group of people, we aim to use gender-neutral terms like “team”, “folks” or “everyone”. [1][ref-gender-neutral-docs] +- We are aware that language shapes reality. Thus, we use inclusive, gender-neutral language in the documents we provide and when we talk to people. When referring to a group of people, we aim to use gender-neutral terms like “team”, “folks” or “everyone”. [1][5] - We respect that people have differences of opinion and criticize constructively. ## Unacceptable Behavior @@ -34,7 +34,7 @@ The members of the core team and project maintainers are responsible for clarify ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting us via support@svengreb.de or directly to one of the project core team members or owner via [email][mailmap]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting us via support@svengreb.de or directly to one of the project core team members or owner via [email][3]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. @@ -52,10 +52,10 @@ This Code of Conduct applies both within project spaces and in public spaces whe --- -Thanks for the inspirations and attributions to GitHub's [Open Source Guides][oss-guides], [Hoodie's Code of Conduct][hoodie-coc] and the [Contributor Covenant Version 1.4][contrib-cov-1.4]. +Thanks for the inspirations and attributions to GitHub's [Open Source Guides][4], [Hoodie's Code of Conduct][2] and the [Contributor Covenant Version 1.4][1]. -[contrib-cov-1.4]: https://contributor-covenant.org/version/1/4/code-of-conduct -[hoodie-coc]: http://hood.ie/code-of-conduct -[mailmap]: https://github.com/svengreb/tmpl-go/blob/main/.mailmap -[oss-guides]: https://opensource.guide -[ref-gender-neutral-docs]: https://modelviewculture.com/pieces/gendered-language-feature-or-bug-in-software-documentation +[1]: https://contributor-covenant.org/version/1/4/code-of-conduct +[2]: http://hood.ie/code-of-conduct +[3]: https://github.com/svengreb/tmpl-go/blob/main/.mailmap +[4]: https://opensource.guide +[5]: https://modelviewculture.com/pieces/gendered-language-feature-or-bug-in-software-documentation diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e505759..35fb5a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,40 +6,40 @@ This is a set of guidelines for contributing to tmpl-go. Please take a moment to Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests. -As for everything else in the project, the contributions to tmpl-go are governed by our [Code of Conduct][gh-coc]. By participating, you are expected to uphold this code. Please report unacceptable behavior at support@svengreb.de or directly to one of the core team members via [email][gh-mailmap]. +As for everything else in the project, the contributions to tmpl-go are governed by our [Code of Conduct][6]. By participating, you are expected to uphold this code. Please report unacceptable behavior at support@svengreb.de or directly to one of the core team members via [email][15]. ## Getting Started tmpl-go is an open source project and we love to receive contributions from the community! There are many ways to contribute, from [writing- and improving documentation and tutorials](#documentations), [reporting bugs](#bug-reports), [submitting enhancement suggestions](#enhancement-suggestions) which can be incorporated into this project by [submitting a pull request](#pull-requests). -The project development workflow and process uses [GitHub Issues][gh-issues]- and [Pull Requests][gh-pr] management to track issues and pull requests including multiple [issue templates][gh-issues-templates]. +The project development workflow and process uses [GitHub Issues][14]- and [Pull Requests][16] management to track issues and pull requests including multiple [issue templates][13]. -Before you continue with these contribution guidelines we highly recommend to read the awesome GitHub [Open Source Guides][os-guide] on how to [making open source contributions][os-guide-contrib]. +Before you continue with these contribution guidelines we highly recommend to read the awesome GitHub [Open Source Guides][29] on how to [making open source contributions][28]. ### Repository Assignment -tmpl is [a modular project][gh-profile-repo-search] of multiple [template repositories][gh-docs-repos-tmpl]. Each repository has a different focus for different use cases, project structures and programming languages. +tmpl is [a modular project][17] of multiple [template repositories][7]. Each repository has a different focus for different use cases, project structures and programming languages. **Please make sure to determine the correct repository before you continue!** -Contributions related to a [specialized template][gh-profile-repo-search], like this one for [Go][], belong to the specific repository while contributions related to [the base template][gh-tmpl] are welcome in its repository. This helps all core team members, committers and maintainer to process every contribution faster without organization overhead. +Contributions related to a [specialized template][17], like this one for [Go][1], belong to the specific repository while contributions related to [the base template][22] are welcome in its repository. This helps all core team members, committers and maintainer to process every contribution faster without organization overhead. ### Bug Reports A bug is a _demonstrable problem_ that is caused by the code in the repository. This section guides you through submitting a bug report for tmpl-go. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior and find related reports. -**Do NOT report security vulnerabilities in public issues!** Please only contact one of the core team members or project owner in a responsible manner by [email][gh-mailmap] or via support@svengreb.de. We will assess the issue as soon as possible on a best-effort basis and will give you an estimate for when we have a fix and release available for an eventual public disclosure. +**Do NOT report security vulnerabilities in public issues!** Please only contact one of the core team members or project owner in a responsible manner by [email][15] or via support@svengreb.de. We will assess the issue as soon as possible on a best-effort basis and will give you an estimate for when we have a fix and release available for an eventual public disclosure. -- **Use the [GitHub Issue search][gh-issues]** — check if the issue has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one. If you find a closed issue that seems like it is the same thing that you are experiencing, open a new issue and include a link to the original issue in the body of your new one. +- **Use the [GitHub Issue search][14]** — check if the issue has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one. If you find a closed issue that seems like it is the same thing that you are experiencing, open a new issue and include a link to the original issue in the body of your new one. - **Determine [which repository the contribution belongs to](#repository-assignment).** -- **Check if the issue has been fixed** — try to reproduce it using the [latest version][gh-releases-latest] and [`main`][gh-branch-main] branch in the repository. +- **Check if the issue has been fixed** — try to reproduce it using the [latest version][18] and [`main`][4] branch in the repository. - **Isolate the problem** — ideally create a [MCVE](#mcve). -When you are creating a bug report, please provide as much detail and context as possible. Fill out on of [the required templates][gh-issues-template-bug], the information it asks helps maintainers to reproduce the problem and resolve issues faster. +When you are creating a bug report, please provide as much detail and context as possible. Fill out on of [the required templates][10], the information it asks helps maintainers to reproduce the problem and resolve issues faster. - **Use a clear and descriptive title** for the issue to identify the problem. - **Describe the exact steps which reproduce the problem** in as many details as possible. - **Include screenshots and animated GIFs** if appropriate which show you following the described steps and clearly demonstrate the problem. -- **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets. If you are providing snippets in the issue, use [Markdown code blocks][ghd-markdown-code-blocks] or [attach files to the issue][ghd-attach-file]. +- **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets. If you are providing snippets in the issue, use [Markdown code blocks][25] or [attach files to the issue][23]. If possible please provide more context by answering these questions: @@ -48,22 +48,22 @@ If possible please provide more context by answering these questions: - What is the most recent version in which the problem does not happen? - **Can you reliably reproduce the issue?** If not, please provide details about how often the problem happens and under which conditions it normally happens. -Please include details about your configuration and environment based on the [issue template][gh-issues-template-bug]. +Please include details about your configuration and environment based on the [issue template][10]. ### Enhancement Suggestions This section guides you through submitting an enhancement suggestion, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions. -- **Use the [GitHub Issues search][gh-issues]** — check if this enhancement has already been suggested. If it has **and the issue is still open**, add your additions as comment to the existing issue instead of opening a new one. +- **Use the [GitHub Issues search][14]** — check if this enhancement has already been suggested. If it has **and the issue is still open**, add your additions as comment to the existing issue instead of opening a new one. - **Determine [which repository the contribution belongs to](#repository-assignment).** -- **Check if the enhancement has already been implemented** — use the [latest version][gh-releases-latest] and [`main`][gh-branch-main] branch to ensure that the feature or improvement has not already been added. +- **Check if the enhancement has already been implemented** — use the [latest version][18] and [`main`][4] branch to ensure that the feature or improvement has not already been added. - **Provide a reduced show case** — ideally create a [MCVE](#mcve). -Before creating enhancement suggestions, please check if your idea fits with the scope and provide as much detail and context as possible using a structured layout like the [the issue template][gh-issues-template-enhancement]. +Before creating enhancement suggestions, please check if your idea fits with the scope and provide as much detail and context as possible using a structured layout like the [the issue template][11]. - **Use a clear and descriptive title** for the issue to identify the suggestion. - **Provide a step-by-step description of the suggested enhancement** in as many details as possible and provide use-cases. -- **Provide examples to demonstrate the need of an enhancement**. Include copy/paste snippets which you use in those examples, use [Markdown code blocks][ghd-markdown-code-blocks] or [attach files to the issue][ghd-attach-file]. +- **Provide examples to demonstrate the need of an enhancement**. Include copy/paste snippets which you use in those examples, use [Markdown code blocks][25] or [attach files to the issue][23]. - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. - **Explain why this enhancement would be useful** to most tmpl-go users. - **Maybe list some other projects where this enhancement exists.** @@ -74,18 +74,18 @@ This section guides you through submitting an pull request. Following these guid **Please [suggest an enhancement](#enhancement-suggestions) or [report a bug](#bug-reports) first before embarking on any significant pull request** (e.g. implementing features, refactoring code, fixing a bug), otherwise you risk spending a lot of time working on something that the core team members and project owner might not want to merge into the project. -When you are submitting an pull request, please provide as much detail and context as possible. Fill out [the required template][gh-issues-template-pr] to help maintainers to understand your submitted code. +When you are submitting an pull request, please provide as much detail and context as possible. Fill out [the required template][12] to help maintainers to understand your submitted code. - **Use a clear and descriptive title for the pull request** -- **Do not include issue numbers in the pull request title** but fill in the metadata section at the top of the [required pull request template][gh-issues-template-pr] making use of the [GitHub issue keywords][ghd-issue-keywords] to link to specific [enhancement suggestions](#enhancement-suggestions) or [bug reports](#bug-reports). +- **Do not include issue numbers in the pull request title** but fill in the metadata section at the top of the [required pull request template][12] making use of the [GitHub issue keywords][24] to link to specific [enhancement suggestions](#enhancement-suggestions) or [bug reports](#bug-reports). - **Include screenshots and animated GIFs** if appropriate which show you following the described steps and clearly demonstrate the change. - **Make sure to follow the [JavaScript](#javascript-style-guide), [Markdown](#markdown-style-guide) and [Git](#git-style-guide) style guides**. - **Remain focused in scope and avoid to include unrelated commits**. - **Features and improvements should always be accompanied with tests and documentation**. If the pull request improves the performance consider to include a benchmark test, optimally including a chart. - **Lint and test before submitting the pull request**. -- **Make sure to create the pull request from a [topic branch][git-docs-branching-workflows]**. +- **Make sure to create the pull request from a [topic branch][27]**. -**All pull requests must be send against the [`main`][gh-branch-main] branch** - Please read the [branch organization](#branch-organization) section below for details about the branching model. +**All pull requests must be send against the [`main`][4] branch** - Please read the [branch organization](#branch-organization) section below for details about the branching model. ### Documentations @@ -95,7 +95,7 @@ You can help improve the docs and guides by making them more coherent, consisten ## Branch Organization -tmpl-go uses the [GitHub Flow][ghg-flow] branching model. The repository consists of the `main` core branch with an infinite development lifecycle. The source code of `HEAD` in this branch contains the latest development state and reflects all tagged release versions. +tmpl-go uses the [GitHub Flow][26] branching model. The repository consists of the `main` core branch with an infinite development lifecycle. The source code of `HEAD` in this branch contains the latest development state and reflects all tagged release versions. **All [pull requests](#pull-requests) for limited development lifecycle _story_/_topic_ branches must be send against the `main` branch**. @@ -113,7 +113,7 @@ Some issues are created with missing information, not reproducible, or plain inv We're always looking for more opinions on discussions in issues and pull request reviews which is a good opportunity to influence the future direction of tmpl-go. -The [question][gh-issues-label-question] issue label is a good place to find ongoing discussions and questions. +The [question][9] issue label is a good place to find ongoing discussions and questions. ## Style Guides @@ -123,17 +123,17 @@ A style guide establishes and enforces style to improve the intelligibility and ### JavaScript Style Guide -tmpl-go adheres to the [Arctic Ice Studio JavaScript Style Guide][gh-styleguide-javascript]. +tmpl-go adheres to the [Arctic Ice Studio JavaScript Style Guide][20]. ### Markdown Style Guide -tmpl-go adheres to the [Arctic Ice Studio Markdown Style Guide][gh-styleguide-markdown]. +tmpl-go adheres to the [Arctic Ice Studio Markdown Style Guide][21]. ### Git Commit Messages A well-crafted Git commit message is the best way to communicate _context_ about a change to the maintainers. The code will tell what changed, but only the commit message can properly tell why. Re-establishing the context of a piece of code is wasteful. We can't avoid it completely, so our efforts should go to reducing it as much as possible. -tmpl-go adheres to the [Arctic Ice Studio Git Style Guide][gh-styleguide-git]. The style guide assumes that you are familiar with the [GitHub Flow][ghg-flow] branching model. +tmpl-go adheres to the [Arctic Ice Studio Git Style Guide][19]. The style guide assumes that you are familiar with the [GitHub Flow][26] branching model. ## MCVE @@ -145,9 +145,9 @@ When [reporting a bug](#bug-reports), sometimes even when [suggesting enhancemen - …Complete – Provide all parts needed to reproduce the behavior - …Verifiable – Test the code you're about to provide to make sure it reproduces the behavior -A MCVE is a common practice like on [Stack Overflow][stackoverflow-mcve] and sometimes it is also called [SSCCE][], a _Short, Self Contained, Correct (Compilable), Example_. +A MCVE is a common practice like on [Stack Overflow][34] and sometimes it is also called [SSCCE][2], a _Short, Self Contained, Correct (Compilable), Example_. -The recommended way for GitHub based projects is to create it as [Gist][gh-gist] or new repository, but of course you can [attach it to issues and pull requests as files][ghd-attach-file], use any free code paste- or file hosting service or paste the code in [Markdown code blocks][ghd-markdown-code-blocks] into the issue. +The recommended way for GitHub based projects is to create it as [Gist][8] or new repository, but of course you can [attach it to issues and pull requests as files][23], use any free code paste- or file hosting service or paste the code in [Markdown code blocks][25] into the issue. ### Minimal @@ -174,44 +174,44 @@ To entirely understand your enhancement or bug report, developers will need to v ## Versioning -tmpl-go follows the [Semantic Versioning Specification][semver] (SemVer). We release patch versions for bug fixes, minor versions for enhancements like new features and improvements, and major versions for any backwards incompatible changes. Deprecation warnings are introduced for breaking changes in a minor version so that users learn about the upcoming changes and migrate their code in advance. +tmpl-go follows the [Semantic Versioning Specification][33] (SemVer). We release patch versions for bug fixes, minor versions for enhancements like new features and improvements, and major versions for any backwards incompatible changes. Deprecation warnings are introduced for breaking changes in a minor version so that users learn about the upcoming changes and migrate their code in advance. -Every significant change is documented in the [changelog][gh-changelog]. +Every significant change is documented in the [changelog][5]. ## Credits -Thanks for the inspirations and attributions to GitHub's [Open Source Guides][os-guide] and various contribution guides of large open source projects like [Atom][gh-atom-contrib], [React][react-contrib] and [Ruby on Rails][ruby-on-rails-contrib]. - -[gh-atom-contrib]: https://github.com/atom/atom/blob/master/CONTRIBUTING.md -[gh-branch-main]: https://github.com/svengreb/tmpl-go/tree/main -[gh-changelog]: https://github.com/svengreb/tmpl-go/blob/main/CHANGELOG.md -[gh-coc]: https://github.com/svengreb/tmpl-go/blob/main/CODE_OF_CONDUCT.md -[gh-docs-repos-tmpl]: https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-template-repository -[gh-gist]: https://gist.github.com -[gh-issues-label-question]: https://github.com/svengreb/tmpl-go/labels/type-question -[gh-issues-template-bug]: https://github.com/svengreb/tmpl-go/blob/main/.github/ISSUE_TEMPLATE/bugs.md -[gh-issues-template-enhancement]: https://github.com/svengreb/tmpl-go/blob/main/.github/ISSUE_TEMPLATE/enhancement.md -[gh-issues-template-pr]: https://github.com/svengreb/tmpl-go/blob/main/.github/PULL_REQUEST_TEMPLATE.md -[gh-issues-templates]: https://github.com/svengreb/tmpl-go/issues/new/choose -[gh-issues]: https://github.com/svengreb/tmpl-go/issues -[gh-mailmap]: https://github.com/svengreb/tmpl-go/blob/main/.mailmap -[gh-pr]: https://github.com/svengreb/tmpl-go/pulls -[gh-profile-repo-search]: https://github.com/svengreb?&tab=repositories&q=tmpl -[gh-releases-latest]: https://github.com/svengreb/tmpl-go/releases/latest -[gh-styleguide-git]: https://github.com/arcticicestudio/styleguide-git -[gh-styleguide-javascript]: https://github.com/arcticicestudio/styleguide-javascript -[gh-styleguide-markdown]: https://github.com/arcticicestudio/styleguide-markdown -[gh-tmpl]: https://github.com/svengreb/tmpl -[ghd-attach-file]: https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests -[ghd-issue-keywords]: https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue -[ghd-markdown-code-blocks]: https://docs.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax -[ghg-flow]: https://guides.github.com/introduction/flow -[git-docs-branching-workflows]: https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows -[go]: https://go.dev -[os-guide-contrib]: https://opensource.guide/how-to-contribute -[os-guide]: https://opensource.guide -[react-contrib]: https://facebook.github.io/react/contributing/how-to-contribute.html -[ruby-on-rails-contrib]: http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html -[semver]: https://semver.org -[sscce]: http://sscce.org -[stackoverflow-mcve]: https://stackoverflow.com/help/mcve +Thanks for the inspirations and attributions to GitHub's [Open Source Guides][29] and various contribution guides of large open source projects like [Atom][3], [React][31] and [Ruby on Rails][32]. + +[1]: https://go.dev +[2]: http://sscce.org +[3]: https://github.com/atom/atom/blob/master/CONTRIBUTING.md +[4]: https://github.com/svengreb/tmpl-go/tree/main +[5]: https://github.com/svengreb/tmpl-go/blob/main/CHANGELOG.md +[6]: https://github.com/svengreb/tmpl-go/blob/main/CODE_OF_CONDUCT.md +[7]: https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-template-repository +[8]: https://gist.github.com +[9]: https://github.com/svengreb/tmpl-go/labels/type-question +[10]: https://github.com/svengreb/tmpl-go/blob/main/.github/ISSUE_TEMPLATE/bugs.md +[11]: https://github.com/svengreb/tmpl-go/blob/main/.github/ISSUE_TEMPLATE/enhancement.md +[12]: https://github.com/svengreb/tmpl-go/blob/main/.github/PULL_REQUEST_TEMPLATE.md +[13]: https://github.com/svengreb/tmpl-go/issues/new/choose +[14]: https://github.com/svengreb/tmpl-go/issues +[15]: https://github.com/svengreb/tmpl-go/blob/main/.mailmap +[16]: https://github.com/svengreb/tmpl-go/pulls +[17]: https://github.com/svengreb?&tab=repositories&q=tmpl +[18]: https://github.com/svengreb/tmpl-go/releases/latest +[19]: https://github.com/arcticicestudio/styleguide-git +[20]: https://github.com/arcticicestudio/styleguide-javascript +[21]: https://github.com/arcticicestudio/styleguide-markdown +[22]: https://github.com/svengreb/tmpl +[23]: https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests +[24]: https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue +[25]: https://docs.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax +[26]: https://guides.github.com/introduction/flow +[27]: https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows +[28]: https://opensource.guide/how-to-contribute +[29]: https://opensource.guide +[31]: https://facebook.github.io/react/contributing/how-to-contribute.html +[32]: http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html +[33]: https://semver.org +[34]: https://stackoverflow.com/help/mcve diff --git a/README.md b/README.md index cacfcfd..c3b61c9 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,36 @@

-

+

-

+

-

A template repository for Go projects.

+

A template repository for Go projects.

Starting a new project repository means to spend a lot of time first for setting up the basic structure and configuration for the used technology stack over and over again. It is a repetitive task since the same tools are often used across many projects, like linters and code formatters, and therefore often just copied over. This has the disadvantage that the configuration or documentation may differ between different projects or common changes and configurations are not synchronize at all. Many tools provide a way to created so called “shared configurations“ that can be used as base and dynamically composed with project-specific configurations, however, this does not apply to all. To prevent such problems a central place, so called “template repository“, for basic configurations and documentations as well as focus on different use cases, project structures and programming languages is a good solution to act as a single-source-of-truth™️. -_tmpl-go_, the imaginative abbreviation for “template Go“, is my solution to enable a smooth start for [Go][] projects and ensure that a project stays healthy, stable and up-to-date over time. Thanks to Go's architecture and tooling this repository can be used as [monorepo][trunkbasedev-monorepos] that can manage multiple Go & web applications or just a single [Go module][go-doc-mod] or package. No matter for what purposes it is used there are no significant changes needed to the repository structure. +_tmpl-go_, the imaginative abbreviation for “template Go“, is my solution to enable a smooth start for [Go][1] projects and ensure that a project stays healthy, stable and up-to-date over time. Thanks to Go's architecture and tooling this repository can be used as [monorepo][73] that can manage multiple Go & web applications or just a single [Go module][64] or package. No matter for what purposes it is used there are no significant changes needed to the repository structure. Please note that _tmpl-go_ has mainly been created for my personal use in mind. The default configurations of this template might not fit your needs, but it was designed to be flexible and can be adapted to different use cases and environments. ## Overview -This repository serves as a template for [Go][] projects including basic tools and configurations with sane default values. -It is built on top of the [base _tmpl_ repository][tmpl] which provides essential features for all kind of projects. Please see the [_tmpl_ project overview documentation][gh-tmpl#overview] for more details. +This repository serves as a template for [Go][1] projects including basic tools and configurations with sane default values. +It is built on top of the [base _tmpl_ repository][14] which provides essential features for all kind of projects. Please see the [_tmpl_ project overview documentation][52] for more details. -- [Build on top of the base _tmpl_ template repository][tmpl] that provides essential features for any project +- [Build on top of the base _tmpl_ template repository][14] that provides essential features for any project - Extended configurations for [GitHub specific features](#github) that are already provided in the base _tmpl_ template repository: - [CI/CD action workflows](#cicd-action-workflows) for Go specific tasks - - [Automated updates and security vulnerability alerts](#automated-dependency-updates) for [Go Module][go-doc-mod] and [Yarn][]/[NPM][] dependencies through the native [Dependabot][] integration + - [Automated updates and security vulnerability alerts](#automated-dependency-updates) for [Go Module][64] and [Yarn][3]/[npm][2] dependencies through the native [Dependabot][5] integration - [Go Module](#go-module) to ensure a stable dependency management -- [golangci-lint][] to [check the Go code quality](#go-code-quality-linting) +- [golangci-lint][6] to [check the Go code quality](#go-code-quality-linting) See the [“Features“](#features) section below for more details. ## Directory Structure -The directory structure shown below is derived from the [base _tmpl_ template repository][tmpl] on which this project is based on. Please see the [“Directory Structure“][tmpl-readme#dir_struct] section in the _tmpl_ documentation for more details. +The directory structure shown below is derived from the [base _tmpl_ template repository][14] on which this project is based on. Please see the [“Directory Structure“][72] section in the _tmpl_ documentation for more details. ```raw tmpl-go @@ -41,7 +41,7 @@ tmpl-go └─ images ``` -The next directory structure shown below is specially designed for Go projects with [monorepo][trunkbasedev-monorepos] layout where some parts were adapted from the [golang-standards/project-layout][] and [ardanlabs/service][] repositories while others are added through experience with own projects and inspiration from other large, production-grade and well-known projects of the Go ecosystem. +The next directory structure shown below is specially designed for Go projects with [monorepo][73] layout where some parts were adapted from the [golang-standards/project-layout][11] and [ardanlabs/service][12] repositories while others are added through experience with own projects and inspiration from other large, production-grade and well-known projects of the Go ecosystem. ```raw tmpl-go @@ -58,154 +58,154 @@ tmpl-go Please see the [“Features“](#features) section below for more details about provided files in this template repository. The detailed documentation about each directory is located in individual `README.md` files within the directory itself. -- [`/api`][gh-tree-api] — The directory for API definition files like [Protocol Buffers][protobuf], [JSON schemas][json-schema] or [OpenAPI][]/[Swagger][] specifications. See the [dedicated `/api` directory documentation][gh-blob-api-readme] for more details and usage examples. -- [`/apps`][gh-tree-apps] — The directory for project application(s) using the Go `main` package that can be compiled to the binary executable. See the [dedicated `/apps` directory documentation][gh-blob-apps-readme] for more details and usage examples. -- [`/config`][gh-tree-config] — The directory for all configurations such as container orchestration deployments, templates for applications or distribution bundles. See the [dedicated `/config` directory documentation][gh-blob-config-readme] for more details and usage examples. -- [`/docs`][gh-tree-docs] — The directory for project documentations, [runbooks][wikip-runbook] and any other kind of textual reference.. See the [dedicated `/docs` directory documentation][gh-blob-docs-readme] for more details and usage examples. -- [`/examples`][gh-tree-examples] — The directory for all configurations such as container orchestration deployments, templates for applications or distribution bundles. See the [dedicated `/examples` directory documentation][gh-blob-examples-readme] for more details and usage examples. -- [`/internal`][gh-tree-internal] — The directory for non-exported (“private“) application and package code. See the [dedicated `/internal` directory documentation][gh-blob-internal-readme] for more details and usage examples. -- [`/pkg`][gh-tree-pkg] — The directory for exported (“public“) APIs and package code. See the [dedicated `/pkg` directory documentation][gh-blob-pkg-readme] for more details and usage examples. -- [`/test`][gh-tree-test] — The directory for additional data and tools for automated testing. See the [dedicated `/test` directory documentation][gh-blob-test-readme] for more details and usage examples. -- [`/web`][gh-tree-web] — The directory for web specific data like [SPA][wikip-spa]s, static websites, web components & packages or server-side rendered templates that are often built with [JAMStack][] principles. See the [dedicated `/web` directory documentation][gh-blob-web-readme] for more details and usage examples. +- [`/api`][54] — The directory for API definition files like [Protocol Buffers][9], [JSON schemas][10] or [OpenAPI][7]/[Swagger][8] specifications. See the [dedicated `/api` directory documentation][27] for more details and usage examples. +- [`/apps`][55] — The directory for project application(s) using the Go `main` package that can be compiled to the binary executable. See the [dedicated `/apps` directory documentation][28] for more details and usage examples. +- [`/config`][56] — The directory for all configurations such as container orchestration deployments, templates for applications or distribution bundles. See the [dedicated `/config` directory documentation][29] for more details and usage examples. +- [`/docs`][57] — The directory for project documentations, [runbooks][74] and any other kind of textual reference.. See the [dedicated `/docs` directory documentation][30] for more details and usage examples. +- [`/examples`][58] — The directory for all configurations such as container orchestration deployments, templates for applications or distribution bundles. See the [dedicated `/examples` directory documentation][33] for more details and usage examples. +- [`/internal`][59] — The directory for non-exported (“private“) application and package code. See the [dedicated `/internal` directory documentation][36] for more details and usage examples. +- [`/pkg`][60] — The directory for exported (“public“) APIs and package code. See the [dedicated `/pkg` directory documentation][38] for more details and usage examples. +- [`/test`][61] — The directory for additional data and tools for automated testing. See the [dedicated `/test` directory documentation][39] for more details and usage examples. +- [`/web`][62] — The directory for web specific data like [SPA][75]s, static websites, web components & packages or server-side rendered templates that are often built with [JAMStack][4] principles. See the [dedicated `/web` directory documentation][42] for more details and usage examples. ## Features -This repository serves as a template repository for [Go][] projects that provides essential features. +This repository serves as a template repository for [Go][1] projects that provides essential features. The sections below contain more detailed information about each feature, the sane default configurations and their files in the repository as well as ways to customize and adjust them to adapt to other use cases and projects. They provide details about files in this repository and the overall directory structure. ### GitHub -This template repository has partially been designed for repositories hosted on GitHub and makes use of many of [its fantastic features][gh-features]. +This template repository has partially been designed for repositories hosted on GitHub and makes use of many of [its fantastic features][49]. #### CI/CD Action Workflows -The [GitHub Actions][gh-feat-actions] `.github/workflows` directory includes a basic [CI/CD workflow files][gh-docs-act-ref-syntax] that run for changes in the Git `main` branch and `v*` tags. The `lint-node` job is [derived from the _tmpl_ template repository][gh-tmpl#gh_act_cicd] and runs all [Node.js based linters][gh-tmpl#overview] that are also included in this template repository. The `ci-go` workflow runs all [configured `golangci-lint` linters](#go-code-quality-linting) and the `test` job runs all [tests with coverage report][go-doc-cmd-cover] and enabled [race detector][go-doc-race_detector]. -To skip a workflow, include a [supported keyword like `[skip actions]`][gh-blog-cl-skip_actions] in a commit message. +The [GitHub Actions][48] `.github/workflows` directory includes a basic [CI/CD workflow files][44] that run for changes in the Git `main` branch and `v*` tags. The `lint-node` job is [derived from the _tmpl_ template repository][51] and runs all [Node.js based linters][52] that are also included in this template repository. The `ci-go` workflow runs all [configured `golangci-lint` linters](#go-code-quality-linting) and the `test` job runs all [tests with coverage report][63] and enabled [race detector][67]. +To skip a workflow, include a [supported keyword like `[skip actions]`][43] in a commit message. #### Automated Dependency Updates -Next to the [Dependabot configuration derived from the base _tmpl_ template repository][gh-tmpl#autp_dep_updates] the [`dependabot.yml` file][gh-blob-dot_github-dependabot.yml] additionally additionally includes [configurations][gh-docs-dependabot] for [Go Module](#go-module) dependencies. +Next to the [Dependabot configuration derived from the base _tmpl_ template repository][50] the [`dependabot.yml` file][31] additionally additionally includes [configurations][45] for [Go Module](#go-module) dependencies. -Make sure to read the [_tmpl_ template repository documentation about automated dependency updates][gh-tmpl#autp_dep_updates] to learn how to enable or disable Dependabot for a GitHub repository. +Make sure to read the [_tmpl_ template repository documentation about automated dependency updates][50] to learn how to enable or disable Dependabot for a GitHub repository. ### Go Module -The [`go.mod`][go-doc-mod#file] and [`go.sum`][go-doc-mod#sum_file] files contain information about the [Go Module][go-doc-mod]. See the [official Go Module reference documentation][go-doc-mod], the [“Modules“ page in the GitHub repository wiki][golang/go-wiki-mod] and the [“Create a Go module“ tutorial][go-doc-tut-mod] for more details. +The [`go.mod`][65] and [`go.sum`][66] files contain information about the [Go Module][64]. See the [official Go Module reference documentation][64], the [“Modules“ page in the GitHub repository wiki][71] and the [“Create a Go module“ tutorial][69] for more details. ### Go Code Quality Linting -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 with many additional configuration features. +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][6] provides a uniform interface to run most popular and useful linters in parallel with many additional configuration features. The actual runner is open source and can be used locally as well in any private CI/CD pipeline. -The [`.golangci.yml` configuration file][gh-blob-dot_golangci] is located in the root of this template repository and comes with sane default configurations that can be simply adjusted and extended. +The [`.golangci.yml` configuration file][32] is located in the root of this template repository and comes with sane default configurations that can be simply adjusted and extended. -The runner is also used in the [the existing _CI_ GitHub action workflows][gh-act-ci] through the [golangci-lint-action][] GitHub action that has been created by the golangci-lint maintainers. See the [“CI/CD Action Workflows“](#cicd-action-workflows) section for more details. +The runner is also used in the [the existing _CI_ GitHub action workflows][26] through the [golangci-lint-action][13] GitHub action that has been created by the golangci-lint maintainers. See the [“CI/CD Action Workflows“](#cicd-action-workflows) section for more details. ## Usage -There are multiple ways to use this template repository, either by [using GitHubs feature to create a repository from a template][gh-docs-repo_from_tmpl] or simply [cloning it][gh-docs-repo_clone]. No matter which method is used, there are a few manual steps to adjust some configurations and documentations for the individual target project. Note that these changes are only recommendations, but are common steps anyway. +There are multiple ways to use this template repository, either by [using GitHubs feature to create a repository from a template][47] or simply [cloning it][46]. No matter which method is used, there are a few manual steps to adjust some configurations and documentations for the individual target project. Note that these changes are only recommendations, but are common steps anyway. -1. Follow the [usage steps of the base _tmpl_ repository][gh-tmpl#usage]. +1. Follow the [usage steps of the base _tmpl_ repository][53]. 2. Adjust or delete the directories and their dedicated documentations of the [“Directory Structure“ section](#directory-structure) to fit your project setup. -3. Adjust the [`go.mod` file][gh-blob-go.mod]… +3. Adjust the [`go.mod` file][34]… - …so that the value of the `module` attribute matches your projects [Go Module](#go-module) name. - - …so that the value of the `go` attribute matches the [Go version][go-doc-rel_hist] used by your project. + - …so that the value of the `go` attribute matches the [Go version][68] used by your project. - …by deleting the already defined `github.com/stretchr/testify` module dependency when it is not used to write tests for your project. -4. Ensure the [`go.sum` file][gh-blob-go.sum] matches the `go.mod` file by deleting it and running `go mod tidy` so Go resolves the dependency tree with the latest module versions. +4. Ensure the [`go.sum` file][35] matches the `go.mod` file by deleting it and running `go mod tidy` so Go resolves the dependency tree with the latest module versions. - …by editing it manually and remove entries of unused dependencies. -5. Adjust or delete the [`tmpl-go.go`][gh-blob-tmpl-go.go] and [`tmpl-go_test.go`][gh-blob-tmpl-go_test.go] files to match your project. -6. Adjust or delete the `workspaces` field of the [`package.json` file][gh-blob-package.json] to match your project. +5. Adjust or delete the [`tmpl-go.go`][41] and [`tmpl-go_test.go`][40] files to match your project. +6. Adjust or delete the `workspaces` field of the [`package.json` file][37] to match your project. ## References -Next to the experience with own projects, many other large, production-grade and well-known projects of the Go ecosystem as well as the [`golang-standards/project-layout` documentation about Go specific directories][golang-standards/project-layout#go_dirs] were used as references. +Next to the experience with own projects, many other large, production-grade and well-known projects of the Go ecosystem as well as the [`golang-standards/project-layout` documentation about Go specific directories][70] were used as references. ## Contributing _tmpl-go_ is an open source project and contributions are always welcome! -There are many ways to contribute, from [writing- and improving documentation and tutorials][contrib-guide-docs], [reporting bugs][contrib-guide-bugs], [submitting enhancement suggestions][contrib-guide-enhance] that can be added to _tmpl-go_ by [submitting pull requests][contrib-guide-pr]. - -Please take a moment to read the [contributing guide][contrib-guide] to learn about the development process, the [styleguides][contrib-guide-styles] to which this project adheres as well as the [branch organization][contrib-guide-branching] and [versioning][contrib-guide-versioning] model. - -The guide also includes information about [minimal, complete, and verifiable examples][contrib-guide-mcve] and other ways to contribute to the project like [improving existing issues][contrib-guide-impr-issues] and [giving feedback on issues and pull requests][contrib-guide-feedback]. - -

Copyright © 2020-present Sven Greb

- -

- -[ardanlabs/service]: https://github.com/ardanlabs/service -[contrib-guide-branching]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#branch-organization -[contrib-guide-bugs]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#bug-reports -[contrib-guide-docs]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#documentations -[contrib-guide-enhance]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#enhancement-suggestions -[contrib-guide-feedback]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#give-feedback-on-issues-and-pull-requests -[contrib-guide-impr-issues]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#improve-issues -[contrib-guide-mcve]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#mcve -[contrib-guide-pr]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#pull-requests -[contrib-guide-styles]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#style-guides -[contrib-guide-versioning]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#versioning -[contrib-guide]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md -[dependabot]: https://dependabot.com -[gh-act-ci]: https://github.com/svengreb/tmpl-go/actions?query=workflow%3Aci -[gh-blob-api-readme]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md -[gh-blob-apps-readme]: https://github.com/svengreb/tmpl-go/blob/main/apps/README.md -[gh-blob-config-readme]: https://github.com/svengreb/tmpl-go/blob/main/config/README.md -[gh-blob-docs-readme]: https://github.com/svengreb/tmpl-go/blob/main/docs/README.md -[gh-blob-dot_github-dependabot.yml]: https://github.com/svengreb/tmpl-go/blob/main/.github/dependabot.yml -[gh-blob-dot_golangci]: https://github.com/svengreb/tmpl-go/blob/main/.golangci.yml -[gh-blob-examples-readme]: https://github.com/svengreb/tmpl-go/blob/main/examples/README.md -[gh-blob-go.mod]: https://github.com/svengreb/tmpl-go/blob/main/go.mod -[gh-blob-go.sum]: https://github.com/svengreb/tmpl-go/blob/main/go.sum -[gh-blob-internal-readme]: https://github.com/svengreb/tmpl-go/blob/main/internal/README.md -[gh-blob-package.json]: https://github.com/svengreb/tmpl-go/blob/main/package.json -[gh-blob-pkg-readme]: https://github.com/svengreb/tmpl-go/blob/main/pkg/README.md -[gh-blob-test-readme]: https://github.com/svengreb/tmpl-go/blob/main/test/README.md -[gh-blob-tmpl-go_test.go]: https://github.com/svengreb/tmpl-go/blob/main/tmpl-go_test.go -[gh-blob-tmpl-go.go]: https://github.com/svengreb/tmpl-go/blob/main/tmpl-go.go -[gh-blob-web-readme]: https://github.com/svengreb/tmpl-go/blob/main/web/README.md -[gh-blog-cl-skip_actions]: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci -[gh-docs-act-ref-syntax]: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions -[gh-docs-dependabot]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates -[gh-docs-repo_clone]: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository -[gh-docs-repo_from_tmpl]: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template -[gh-feat-actions]: https://github.com/features/actions -[gh-features]: https://github.com/features -[gh-tmpl#autp_dep_updates]: https://github.com/svengreb/tmpl#automated-dependency-updates -[gh-tmpl#gh_act_cicd]: https://github.com/svengreb/tmpl#cicd-action-workflow -[gh-tmpl#overview]: https://github.com/svengreb/tmpl#overview -[gh-tmpl#usage]: https://github.com/svengreb/tmpl#usage -[gh-tree-api]: https://github.com/svengreb/tmpl-go/tree/main/api -[gh-tree-apps]: https://github.com/svengreb/tmpl-go/tree/main/apps -[gh-tree-config]: https://github.com/svengreb/tmpl-go/tree/main/config -[gh-tree-docs]: https://github.com/svengreb/tmpl-go/tree/main/docs -[gh-tree-examples]: https://github.com/svengreb/tmpl-go/tree/main/examples -[gh-tree-internal]: https://github.com/svengreb/tmpl-go/tree/main/internal -[gh-tree-pkg]: https://github.com/svengreb/tmpl-go/tree/main/pkg -[gh-tree-test]: https://github.com/svengreb/tmpl-go/tree/main/test -[gh-tree-web]: https://github.com/svengreb/tmpl-go/tree/main/web -[go-doc-cmd-cover]: https://golang.org/cmd/cover -[go-doc-mod]: https://golang.org/ref/mod -[go-doc-mod#file]: https://golang.org/ref/mod#go-mod-file -[go-doc-mod#sum_file]: https://golang.org/ref/mod#go -[go-doc-race_detector]: https://golang.org/doc/articles/race_detector.html -[go-doc-rel_hist]: https://golang.org/doc/devel/release.html -[go-doc-tut-mod]: https://golang.org/doc/tutorial/create-module -[go]: https://go.dev -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout -[golang-standards/project-layout#go_dirs]: https://github.com/golang-standards/project-layout#go-directories -[golang/go-wiki-mod]: https://github.com/golang/go/wiki/Modules -[golangci-lint-action]: https://github.com/golangci/golangci-lint-action -[golangci-lint]: https://github.com/golangci/golangci-lint -[jamstack]: https://jamstack.org -[json-schema]: https://json-schema.org -[npm]: https://www.npmjs.com -[openapi]: https://www.openapis.org -[protobuf]: https://developers.google.com/protocol-buffers -[swagger]: https://swagger.io -[tmpl-readme#dir_struct]: https://github.com/svengreb/tmpl#directory-structure -[tmpl]: https://github.com/svengreb/tmpl -[trunkbasedev-monorepos]: https://trunkbaseddevelopment.com/monorepos -[wikip-runbook]: https://en.wikipedia.org/wiki/Runbook -[wikip-spa]: https://en.wikipedia.org/wiki/Single-page_application -[yarn]: https://yarnpkg.com +There are many ways to contribute, from [writing- and improving documentation and tutorials][17], [reporting bugs][16], [submitting enhancement suggestions][18] that can be added to _tmpl-go_ by [submitting pull requests][22]. + +Please take a moment to read the [contributing guide][25] to learn about the development process, the [styleguides][23] to which this project adheres as well as the [branch organization][15] and [versioning][24] model. + +The guide also includes information about [minimal, complete, and verifiable examples][21] and other ways to contribute to the project like [improving existing issues][20] and [giving feedback on issues and pull requests][19]. + +

Copyright © 2020-present Sven Greb

+ +

+ +[1]: https://go.dev +[2]: https://www.npmjs.com +[3]: https://yarnpkg.com +[4]: https://jamstack.org +[5]: https://dependabot.com +[6]: https://github.com/golangci/golangci-lint +[7]: https://www.openapis.org +[8]: https://swagger.io +[9]: https://developers.google.com/protocol-buffers +[10]: https://json-schema.org +[11]: https://github.com/golang-standards/project-layout +[12]: https://github.com/ardanlabs/service +[13]: https://github.com/golangci/golangci-lint-action +[14]: https://github.com/svengreb/tmpl +[15]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#branch-organization +[16]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#bug-reports +[17]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#documentations +[18]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#enhancement-suggestions +[19]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#give-feedback-on-issues-and-pull-requests +[20]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#improve-issues +[21]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#mcve +[22]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#pull-requests +[23]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#style-guides +[24]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md#versioning +[25]: https://github.com/svengreb/tmpl-go/blob/main/CONTRIBUTING.md +[26]: https://github.com/svengreb/tmpl-go/actions?query=workflow%3Aci +[27]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md +[28]: https://github.com/svengreb/tmpl-go/blob/main/apps/README.md +[29]: https://github.com/svengreb/tmpl-go/blob/main/config/README.md +[30]: https://github.com/svengreb/tmpl-go/blob/main/docs/README.md +[31]: https://github.com/svengreb/tmpl-go/blob/main/.github/dependabot.yml +[32]: https://github.com/svengreb/tmpl-go/blob/main/.golangci.yml +[33]: https://github.com/svengreb/tmpl-go/blob/main/examples/README.md +[34]: https://github.com/svengreb/tmpl-go/blob/main/go.mod +[35]: https://github.com/svengreb/tmpl-go/blob/main/go.sum +[36]: https://github.com/svengreb/tmpl-go/blob/main/internal/README.md +[37]: https://github.com/svengreb/tmpl-go/blob/main/package.json +[38]: https://github.com/svengreb/tmpl-go/blob/main/pkg/README.md +[39]: https://github.com/svengreb/tmpl-go/blob/main/test/README.md +[40]: https://github.com/svengreb/tmpl-go/blob/main/tmpl-go_test.go +[41]: https://github.com/svengreb/tmpl-go/blob/main/tmpl-go.go +[42]: https://github.com/svengreb/tmpl-go/blob/main/web/README.md +[43]: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci +[44]: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions +[45]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates +[46]: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository +[47]: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template +[48]: https://github.com/features/actions +[49]: https://github.com/features +[50]: https://github.com/svengreb/tmpl#automated-dependency-updates +[51]: https://github.com/svengreb/tmpl#cicd-action-workflow +[52]: https://github.com/svengreb/tmpl#overview +[53]: https://github.com/svengreb/tmpl#usage +[54]: https://github.com/svengreb/tmpl-go/tree/main/api +[55]: https://github.com/svengreb/tmpl-go/tree/main/apps +[56]: https://github.com/svengreb/tmpl-go/tree/main/config +[57]: https://github.com/svengreb/tmpl-go/tree/main/docs +[58]: https://github.com/svengreb/tmpl-go/tree/main/examples +[59]: https://github.com/svengreb/tmpl-go/tree/main/internal +[60]: https://github.com/svengreb/tmpl-go/tree/main/pkg +[61]: https://github.com/svengreb/tmpl-go/tree/main/test +[62]: https://github.com/svengreb/tmpl-go/tree/main/web +[63]: https://golang.org/cmd/cover +[64]: https://golang.org/ref/mod +[65]: https://golang.org/ref/mod#go-mod-file +[66]: https://golang.org/ref/mod#go +[67]: https://golang.org/doc/articles/race_detector.html +[68]: https://golang.org/doc/devel/release.html +[69]: https://golang.org/doc/tutorial/create-module +[70]: https://github.com/golang-standards/project-layout#go-directories +[71]: https://github.com/golang/go/wiki/Modules +[72]: https://github.com/svengreb/tmpl#directory-structure +[73]: https://trunkbaseddevelopment.com/monorepos +[74]: https://en.wikipedia.org/wiki/Runbook +[75]: https://en.wikipedia.org/wiki/Single-page_application diff --git a/api/README.md b/api/README.md index 979870e..b8de844 100644 --- a/api/README.md +++ b/api/README.md @@ -1,8 +1,8 @@ The `/api` directory stores API definition files like for example… -- [Protocol Buffers][protobuf] -- [OpenAPI][]/[Swagger][] specifications -- [JSON schemas][json-schema] +- [Protocol Buffers][4] +- [OpenAPI][2]/[Swagger][1] specifications +- [JSON schemas][10] ## Directory Structure @@ -10,9 +10,9 @@ A common practice is that API definition files are placed corresponding to the v ## Example -When using [Protocol Buffer][protobuf] the official style guide also recommends to lay out the directory structure for the `.proto` files based on the API version and [package paths][protobuf-docs-style#pkgs]. +When using [Protocol Buffer][4] the official style guide also recommends to lay out the directory structure for the `.proto` files based on the API version and [package paths][11]. -This example assumes an API that has been designed to manage notes. It uses a [flat major based versioning format][gcloud-blog-api_versioning] starting at `v1`. +This example assumes an API that has been designed to manage notes. It uses a [flat major based versioning format][5] starting at `v1`. The `api` directory structure could be constructed as follows: ```raw @@ -73,21 +73,21 @@ enum Kind { ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the API design and Go ecosystem have been used as references: - -- [Google APIs][gh-googleapis] -- [Kubernetes][gh-kubernetes-tree-api] -- [Moby][gh-moby-tree-api] -- [NATS JetStream][gh-nats-jetstream-tree-schemas_source] - -[gcloud-blog-api_versioning]: https://cloud.google.com/blog/products/gcp/api-design-which-version-of-versioning-is-right-for-you -[gh-googleapis]: https://github.com/googleapis/googleapis -[gh-kubernetes-tree-api]: https://github.com/kubernetes/kubernetes/tree/master/api -[gh-moby-tree-api]: https://github.com/moby/moby/tree/master/api -[gh-nats-jetstream-tree-schemas_source]: https://github.com/nats-io/jetstream/tree/master/schemas_source -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout -[json-schema]: https://json-schema.org -[openapi]: https://www.openapis.org -[protobuf-docs-style#pkgs]: https://developers.google.com/protocol-buffers/docs/style#packages -[protobuf]: https://developers.google.com/protocol-buffers -[swagger]: https://swagger.io +Next to the experience with own projects and [golang-standards/project-layout][3], many other large, production-grade and well-known projects of the API design and Go ecosystem have been used as references: + +- [Google APIs][6] +- [Kubernetes][7] +- [Moby][8] +- [NATS JetStream][9] + +[1]: https://swagger.io +[2]: https://www.openapis.org +[3]: https://github.com/golang-standards/project-layout +[4]: https://developers.google.com/protocol-buffers +[5]: https://cloud.google.com/blog/products/gcp/api-design-which-version-of-versioning-is-right-for-you +[6]: https://github.com/googleapis/googleapis +[7]: https://github.com/kubernetes/kubernetes/tree/master/api +[8]: https://github.com/moby/moby/tree/master/api +[9]: https://github.com/nats-io/jetstream/tree/master/schemas_source +[10]: https://json-schema.org +[11]: https://developers.google.com/protocol-buffers/docs/style#packages diff --git a/apps/README.md b/apps/README.md index 7bd4c14..60d42e7 100644 --- a/apps/README.md +++ b/apps/README.md @@ -3,14 +3,14 @@ The `/apps` directory stores source code of project application(s) using the Go ## Directory Structure A common practice is that each application is placed in an individual directory that should match the name of the resulting binary executable. -The structure always depends on the type and use case(s) of the application, but in general the code only consists of the `main` package and function that mainly imports and invokes reuseable code from the [`/internal`][gh-tree-internal] and [`/pkg`][gh-tree-pkg] directories. +The structure always depends on the type and use case(s) of the application, but in general the code only consists of the `main` package and function that mainly imports and invokes reuseable code from the [`/internal`][8] and [`/pkg`][9] directories. -Code that is only relevant for an individual application like configurations, internal logic and commands can also be placed inside directories like `config`, `internal` and `internal/cmd`. In comparison, code that is reusable and could be imported from outside the module should never be placed in the application specific directory but [`/pkg`][gh-tree-pkg]. +Code that is only relevant for an individual application like configurations, internal logic and commands can also be placed inside directories like `config`, `internal` and `internal/cmd`. In comparison, code that is reusable and could be imported from outside the module should never be placed in the application specific directory but [`/pkg`][9]. Please see the [example](#example) below for a common and practical usage pattern. ## Example -Given the API defined in the [example of the `/api` directory][gh-blob-api-readme#example] and additionally assuming another service application named `notes-sync` the structure for the application could be created as follows: +Given the API defined in the [example of the `/api` directory][3] and additionally assuming another service application named `notes-sync` the structure for the application could be created as follows: ```raw apps @@ -31,20 +31,20 @@ apps ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: - -- [Kubernetes][gh-kubernetes-tree-cmd] -- [Prometheus][gh-prometheus-tree-cmd] -- [Moby][gh-moby-tree-cmd] -- [Ardan Labs “Service Starter Kit“][ardanlabs/service] -- [InfluxDB][gh-influxdb-tree-cmd] - -[ardanlabs/service]: https://github.com/ardanlabs/service/tree/master/app -[gh-blob-api-readme#example]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example -[gh-influxdb-tree-cmd]: https://github.com/influxdata/influxdb/tree/master/cmd -[gh-kubernetes-tree-cmd]: https://github.com/kubernetes/kubernetes/tree/master/cmd -[gh-moby-tree-cmd]: https://github.com/moby/moby/tree/master/cmd -[gh-prometheus-tree-cmd]: https://github.com/prometheus/prometheus/tree/master/cmd -[gh-tree-internal]: https://github.com/svengreb/tmpl-go/tree/main/internal -[gh-tree-pkg]: https://github.com/svengreb/tmpl-go/tree/main/pkg -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout +Next to the experience with own projects and [golang-standards/project-layout][1], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: + +- [Kubernetes][5] +- [Prometheus][7] +- [Moby][6] +- [Ardan Labs “Service Starter Kit“][2] +- [InfluxDB][4] + +[1]: https://github.com/golang-standards/project-layout +[2]: https://github.com/ardanlabs/service/tree/master/app +[3]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example +[4]: https://github.com/influxdata/influxdb/tree/master/cmd +[5]: https://github.com/kubernetes/kubernetes/tree/master/cmd +[6]: https://github.com/moby/moby/tree/master/cmd +[7]: https://github.com/prometheus/prometheus/tree/master/cmd +[8]: https://github.com/svengreb/tmpl-go/tree/main/internal +[9]: https://github.com/svengreb/tmpl-go/tree/main/pkg diff --git a/config/README.md b/config/README.md index 729c2d0..30cd7c0 100644 --- a/config/README.md +++ b/config/README.md @@ -1,8 +1,8 @@ The `/config` directory, also often named `contrib`, stores all configurations of any kind such as… -- …container orchestration deployments — tools like Automated scaling and management systems like [Kubernetes][] or [Docker Compose][docker-compose] as well as tools to manage and process their configurations like [Kustomize][] and [Helm][]. -- …application configuration templates — reference, example or starter files that contain default values configurations of applications in the [`/apps` directory][gh-tree-apps]. -- …platform and distribution specific configurations — basic, platform specific configuration files for distribution or deployment purposes like for example [systemd][] units, process managers/supervisors or reverse proxies. +- …container orchestration deployments — tools like Automated scaling and management systems like [Kubernetes][1] or [Docker Compose][4] as well as tools to manage and process their configurations like [Kustomize][3] and [Helm][2]. +- …application configuration templates — reference, example or starter files that contain default values configurations of applications in the [`/apps` directory][19]. +- …platform and distribution specific configurations — basic, platform specific configuration files for distribution or deployment purposes like for example [systemd][5] units, process managers/supervisors or reverse proxies. ## Directory Structure @@ -10,7 +10,7 @@ The files should be placed in separate directories based on their purpose or tar ## Example -Given the [example of the `/api` directory][gh-blob-api-readme#example] the structure for some common configurations could be created as follows: +Given the [example of the `/api` directory][8] the structure for some common configurations could be created as follows: ```raw config @@ -42,35 +42,35 @@ config ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: +Next to the experience with own projects and [golang-standards/project-layout][6], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: -- [Moby][gh-moby-tree-contrib] -- [Knative][gh-knative-tree-config] -- [Ardan Labs “Service Starter Kit“][gh-ardanlabs/service-tree-zarf] -- [Loki][gh-loki-tree-production] -- [NATS][gh-nats-server-tree-docker] -- [etcd][gh-etcd-tree-contrib] -- Dapr ([Helm Charts][gh-dapr-tree-charts], [Grafana][gh-dapr-tree-grafana], [Docker][gh-dapr-tree-docker], [Swagger][gh-dapr-tree-swagger]) -- [Velero][gh-velero-tree-config] -- [Kubernetes][gh-kubernetes-tree-hack] +- [Moby][17] +- [Knative][14] +- [Ardan Labs “Service Starter Kit“][7] +- [Loki][16] +- [NATS][18] +- [etcd][13] +- Dapr ([Helm Charts][9], [Grafana][11], [Docker][10], [Swagger][12]) +- [Velero][20] +- [Kubernetes][15] -[docker-compose]: https://docs.docker.com/compose -[gh-ardanlabs/service-tree-zarf]: https://github.com/ardanlabs/service/tree/master/zarf -[gh-blob-api-readme#example]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example -[gh-dapr-tree-charts]: https://github.com/dapr/dapr/tree/master/charts/dapr -[gh-dapr-tree-docker]: https://github.com/dapr/dapr/tree/master/docker -[gh-dapr-tree-grafana]: https://github.com/dapr/dapr/tree/master/grafana -[gh-dapr-tree-swagger]: https://github.com/dapr/dapr/tree/master/swagger -[gh-etcd-tree-contrib]: https://github.com/etcd-io/etcd/tree/master/contrib -[gh-knative-tree-config]: https://github.com/knative/serving/tree/master/config -[gh-kubernetes-tree-hack]: https://github.com/kubernetes/kubernetes/tree/master/hack -[gh-loki-tree-production]: https://github.com/grafana/loki/tree/master/production -[gh-moby-tree-contrib]: https://github.com/moby/moby/tree/master/contrib -[gh-nats-server-tree-docker]: https://github.com/nats-io/nats-server/tree/master/docker -[gh-tree-apps]: https://github.com/svengreb/tmpl-go/tree/main/apps -[gh-velero-tree-config]: https://github.com/vmware-tanzu/velero/tree/main/config -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout -[helm]: https://helm.sh -[kubernetes]: https://kubernetes.io -[kustomize]: https://kustomize.io -[systemd]: https://www.freedesktop.org/wiki/Software/systemd +[1]: https://kubernetes.io +[2]: https://helm.sh +[3]: https://kustomize.io +[4]: https://docs.docker.com/compose +[5]: https://www.freedesktop.org/wiki/Software/systemd +[6]: https://github.com/golang-standards/project-layout +[7]: https://github.com/ardanlabs/service/tree/master/zarf +[8]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example +[9]: https://github.com/dapr/dapr/tree/master/charts/dapr +[10]: https://github.com/dapr/dapr/tree/master/docker +[11]: https://github.com/dapr/dapr/tree/master/grafana +[12]: https://github.com/dapr/dapr/tree/master/swagger +[13]: https://github.com/etcd-io/etcd/tree/master/contrib +[14]: https://github.com/knative/serving/tree/master/config +[15]: https://github.com/kubernetes/kubernetes/tree/master/hack +[16]: https://github.com/grafana/loki/tree/master/production +[17]: https://github.com/moby/moby/tree/master/contrib +[18]: https://github.com/nats-io/nats-server/tree/master/docker +[19]: https://github.com/svengreb/tmpl-go/tree/main/apps +[20]: https://github.com/vmware-tanzu/velero/tree/main/config diff --git a/docs/README.md b/docs/README.md index 1fad931..575afb8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,12 +1,12 @@ -The `/docs` directory stores project documentations, [runbooks][wikip-runbook] and any other kind of textual reference. These are often written in formats like [Markdown][wikip-md] and, depending on the project scope and technology stack, require a preprocessor. Note that documentations built with web based tools like [static site generators][jamstack-gens] (e.g. [Gatsby][], [Next.js][] or [Hugo][]) should be placed as own package in the [`/web` directory][gh-tree-web]. +The `/docs` directory stores project documentations, [runbooks][24] and any other kind of textual reference. These are often written in formats like [Markdown][23] and, depending on the project scope and technology stack, require a preprocessor. Note that documentations built with web based tools like [static site generators][22] (e.g. [Gatsby][1], [Next.js][3] or [Hugo][2]) should be placed as own package in the [`/web` directory][19]. ## Directory Structure -The layout always depends on the individual use case(s) of the project and when hosted on platforms like [GitHub Pages][gh-docs-pages] or [GitLab Pages][gl-pages]. A common practice is to store documentations in separate repositories, often in combination with static site generator configurations, for example the [official Kubernetes website][gh-kubernetes/website] or [Knative documentations][gh-knative/docs]. +The layout always depends on the individual use case(s) of the project and when hosted on platforms like [GitHub Pages][8] or [GitLab Pages][21]. A common practice is to store documentations in separate repositories, often in combination with static site generator configurations, for example the [official Kubernetes website][14] or [Knative documentations][13]. ## Example -Given the [example of the `/api` directory][gh-blob-api-readme#example] the structure for some common configurations could be created as follows: +Given the [example of the `/api` directory][6] the structure for some common configurations could be created as follows: ```raw docs @@ -32,42 +32,42 @@ docs ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: +Next to the experience with own projects and [golang-standards/project-layout][4], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: -- [Dapr][gh-dapr-tree-docs] -- [Perkeep][gh-perkeep-tree-doc] -- [Hugo][gh-hugo-tree-docs] -- [Argo][gh-argo-tree-docs] -- [Prometheus][gh-prometheus-tree-docs] -- [Moby][gh-moby-tree-docs] -- [Knative][gh-knative-tree-docs] -- [MinIO][gh-minio-tree-docs] -- [GoPass][gh-gopass-tree-docs] -- [Flynn][gh-flynn-tree-docs] -- [Flynn][gh-flynn-tree-docs] -- [Velero][gh-velero-tree-design] +- [Dapr][7] +- [Perkeep][17] +- [Hugo][11] +- [Argo][5] +- [Prometheus][18] +- [Moby][16] +- [Knative][12] +- [MinIO][15] +- [GoPass][10] +- [Flynn][9] +- [Flynn][9] +- [Velero][20] -[gatsby]: https://www.gatsbyjs.com -[gh-argo-tree-docs]: https://github.com/argoproj/argo/tree/master/docs -[gh-blob-api-readme#example]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example -[gh-dapr-tree-docs]: https://github.com/dapr/dapr/tree/master/docs -[gh-docs-pages]: https://docs.github.com/en/free-pro-team@latest/github/working-with-github-pages/about-github-pages -[gh-flynn-tree-docs]: https://github.com/flynn/flynn/tree/master/docs -[gh-gopass-tree-docs]: https://github.com/gopasspw/gopass/tree/master/docs -[gh-hugo-tree-docs]: https://github.com/gohugoio/hugo/tree/master/docs -[gh-knative-tree-docs]: https://github.com/knative/serving/tree/master/docs -[gh-knative/docs]: https://github.com/knative/docs -[gh-kubernetes/website]: https://github.com/kubernetes/website -[gh-minio-tree-docs]: https://github.com/minio/minio/tree/master/docs -[gh-moby-tree-docs]: https://github.com/moby/moby/tree/master/docs -[gh-perkeep-tree-doc]: https://github.com/perkeep/perkeep/tree/master/doc -[gh-prometheus-tree-docs]: https://github.com/prometheus/prometheus/tree/master/docs -[gh-tree-web]: https://github.com/svengreb/tmpl-go/tree/main/web -[gh-velero-tree-design]: https://github.com/vmware-tanzu/velero/tree/main/design -[gl-pages]: https://about.gitlab.com/stages-devops-lifecycle/pages -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout -[hugo]: https://gohugo.io -[jamstack-gens]: https://jamstack.org/generators -[next.js]: https://jamstack.org/generators/next -[wikip-md]: https://en.wikipedia.org/wiki/Markdown -[wikip-runbook]: https://en.wikipedia.org/wiki/Runbook +[1]: https://www.gatsbyjs.com +[2]: https://gohugo.io +[3]: https://jamstack.org/generators/next +[4]: https://github.com/golang-standards/project-layout +[5]: https://github.com/argoproj/argo/tree/master/docs +[6]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example +[7]: https://github.com/dapr/dapr/tree/master/docs +[8]: https://docs.github.com/en/free-pro-team@latest/github/working-with-github-pages/about-github-pages +[9]: https://github.com/flynn/flynn/tree/master/docs +[10]: https://github.com/gopasspw/gopass/tree/master/docs +[11]: https://github.com/gohugoio/hugo/tree/master/docs +[12]: https://github.com/knative/serving/tree/master/docs +[13]: https://github.com/knative/docs +[14]: https://github.com/kubernetes/website +[15]: https://github.com/minio/minio/tree/master/docs +[16]: https://github.com/moby/moby/tree/master/docs +[17]: https://github.com/perkeep/perkeep/tree/master/doc +[18]: https://github.com/prometheus/prometheus/tree/master/docs +[19]: https://github.com/svengreb/tmpl-go/tree/main/web +[20]: https://github.com/vmware-tanzu/velero/tree/main/design +[21]: https://about.gitlab.com/stages-devops-lifecycle/pages +[22]: https://jamstack.org/generators +[23]: https://en.wikipedia.org/wiki/Markdown +[24]: https://en.wikipedia.org/wiki/Runbook diff --git a/examples/README.md b/examples/README.md index ca97177..d1a33eb 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,4 +1,4 @@ -The `/examples` directory stores examples for provided APIs that are defined in the [`/api` directory][gh-tree-api], public packages from the [`/pkg` directory][gh-tree-pkg], ways to use and run applications from the [`/apps` directory][gh-tree-apps] or to demonstrate the integration with other applications, platforms or systems. +The `/examples` directory stores examples for provided APIs that are defined in the [`/api` directory][4], public packages from the [`/pkg` directory][6], ways to use and run applications from the [`/apps` directory][5] or to demonstrate the integration with other applications, platforms or systems. ## Directory Structure @@ -6,7 +6,7 @@ A common practice is that each example is placed in an individual directory whos ## Example -Given the API defined in the [example of the `/api` directory][gh-blob-api-readme#example] the structure could be created as follows: +Given the API defined in the [example of the `/api` directory][2] the structure could be created as follows: ```raw examples @@ -16,15 +16,15 @@ examples ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: +Next to the experience with own projects and [golang-standards/project-layout][1], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: -- [NATS][gh-nats-tree-examples] -- [Velero][gh-velero-tree-examples] +- [NATS][3] +- [Velero][7] -[gh-blob-api-readme#example]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example -[gh-nats-tree-examples]: https://github.com/nats-io/nats.go/tree/master/examples -[gh-tree-api]: https://github.com/svengreb/tmpl-go/tree/main/api -[gh-tree-apps]: https://github.com/svengreb/tmpl-go/tree/main/apps -[gh-tree-pkg]: https://github.com/svengreb/tmpl-go/tree/main/pkg -[gh-velero-tree-examples]: https://github.com/vmware-tanzu/velero/tree/main/examples -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout +[1]: https://github.com/golang-standards/project-layout +[2]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example +[3]: https://github.com/nats-io/nats.go/tree/master/examples +[4]: https://github.com/svengreb/tmpl-go/tree/main/api +[5]: https://github.com/svengreb/tmpl-go/tree/main/apps +[6]: https://github.com/svengreb/tmpl-go/tree/main/pkg +[7]: https://github.com/vmware-tanzu/velero/tree/main/examples diff --git a/internal/README.md b/internal/README.md index 4d9eb78..c8473e8 100644 --- a/internal/README.md +++ b/internal/README.md @@ -1,15 +1,15 @@ -The `/internal` directory stores non-exported (“private“) application and package code that, in comparison to code in the [`/pkg` directory][gh-tree-pkg], can never be imported in other modules. As of [Go version 1.4 the compiler itself enforces the `internal` directory naming pattern][go-doc-rln-1.4#int_pkg] and prevents all packages within this directory to be imported by other modules outside the module in which they reside. Note that this pattern it not limited to the top level `/internal` directory but to any nested `internal` directory within the module. +The `/internal` directory stores non-exported (“private“) application and package code that, in comparison to code in the [`/pkg` directory][10], can never be imported in other modules. As of [Go version 1.4 the compiler itself enforces the `internal` directory naming pattern][12] and prevents all packages within this directory to be imported by other modules outside the module in which they reside. Note that this pattern it not limited to the top level `/internal` directory but to any nested `internal` directory within the module. ## Directory Structure -A common practice is that the `/internal` directory contains sub-directories to separate code targeted only for individual applications using the same pattern like the [`/apps` directory][gh-tree-apps] or module-wide code like stored in the [`/pkg` directory][gh-tree-pkg]. +A common practice is that the `/internal` directory contains sub-directories to separate code targeted only for individual applications using the same pattern like the [`/apps` directory][9] or module-wide code like stored in the [`/pkg` directory][10]. Each application is placed in an individual directory that should match the name of the resulting binary executable. -The structure always depends on the type and use case(s) of the application, but in general the code only consists of the `main` package and function that mainly imports and invokes reuseable code from the [`/internal`][gh-tree-internal] and directories. This helps to better visualize the intended package use and distinguish shared and non-shared code. +The structure always depends on the type and use case(s) of the application, but in general the code only consists of the `main` package and function that mainly imports and invokes reuseable code from the [`/internal`][8] and directories. This helps to better visualize the intended package use and distinguish shared and non-shared code. ## Example -Given the [example of the `/api` directory][gh-blob-api-readme#example] the structure could be created as follows: +Given the [example of the `/api` directory][2] the structure could be created as follows: ```raw internal @@ -31,24 +31,24 @@ internal ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: - -- [Terraform][gh-terraform-tree-internal] -- [NATS][gh-nats-server-tree-internal] -- [InfluxDB][gh-influxdb-tree-internal] -- [Perkeep][gh-perkeep-tree-internal] -- [Jaeger][gh-jaeger-tree-internal] -- [Waypoint][gh-waypoint-tree-internal-pkg] - -[gh-blob-api-readme#example]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example -[gh-influxdb-tree-internal]: https://github.com/influxdata/influxdb/tree/master/internal -[gh-jaeger-tree-internal]: https://github.com/jaegertracing/jaeger/tree/master/internal -[gh-nats-server-tree-internal]: https://github.com/nats-io/nats-server/tree/master/internal -[gh-perkeep-tree-internal]: https://github.com/perkeep/perkeep/tree/master/internal -[gh-terraform-tree-internal]: https://github.com/hashicorp/terraform/tree/master/internal -[gh-tree-internal]: https://github.com/svengreb/tmpl-go/tree/main/internal -[gh-tree-apps]: https://github.com/svengreb/tmpl-go/tree/main/apps -[gh-tree-pkg]: https://github.com/svengreb/tmpl-go/tree/main/pkg -[gh-waypoint-tree-internal-pkg]: https://github.com/hashicorp/waypoint/tree/main/internal/pkg -[go-doc-rln-1.4#int_pkg]: https://golang.org/doc/go1.4#internalpackages -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout +Next to the experience with own projects and [golang-standards/project-layout][1], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: + +- [Terraform][7] +- [NATS][5] +- [InfluxDB][3] +- [Perkeep][6] +- [Jaeger][4] +- [Waypoint][11] + +[1]: https://github.com/golang-standards/project-layout +[2]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example +[3]: https://github.com/influxdata/influxdb/tree/master/internal +[4]: https://github.com/jaegertracing/jaeger/tree/master/internal +[5]: https://github.com/nats-io/nats-server/tree/master/internal +[6]: https://github.com/perkeep/perkeep/tree/master/internal +[7]: https://github.com/hashicorp/terraform/tree/master/internal +[8]: https://github.com/svengreb/tmpl-go/tree/main/internal +[9]: https://github.com/svengreb/tmpl-go/tree/main/apps +[10]: https://github.com/svengreb/tmpl-go/tree/main/pkg +[11]: https://github.com/hashicorp/waypoint/tree/main/internal/pkg +[12]: https://golang.org/doc/go1.4#internalpackages diff --git a/package-lock.json b/package-lock.json index 3932d1f..5a4ad1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@svengreb/tmpl-go", - "version": "0.8.0", + "version": "0.9.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@svengreb/tmpl-go", - "version": "0.8.0", + "version": "0.9.0", "license": "MIT", "workspaces": [ "web/apps", diff --git a/package.json b/package.json index 93cd760..24400aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@svengreb/tmpl-go", - "version": "0.8.0", + "version": "0.9.0", "description": "A template repository for Go projects", "author": "Sven Greb (https://www.svengreb.de)", "homepage": "https://github.com/svengreb/tmpl-go", diff --git a/pkg/README.md b/pkg/README.md index b2b3573..3a0ca1a 100644 --- a/pkg/README.md +++ b/pkg/README.md @@ -1,4 +1,4 @@ -The `/pkg` directory stores exported (“public“) API, application and package code that, in comparison to code in the top level [`/internal`][gh-tree-internal] or any nested `internal` directory, can be imported in other modules. +The `/pkg` directory stores exported (“public“) API, application and package code that, in comparison to code in the top level [`/internal`][16] or any nested `internal` directory, can be imported in other modules. One reason why this template repository make use of the top level `/pkg` directory is, next to the fact that is has already become best practice anyway, that it allows to keep the repository root clean instead of cluttering it with directories that contain Go and non-Go source code. It is also a good way to explicitly communicate that code in the `/pkg` directory is meant and safe to be used and integrated in other projects. There are many projects with repository roots that contain more than 30 directories where you need to check each to know if it belongs to the Go code base or if it stores any other project related files. This mess is often justified only by the fact that it allows to simplify package import paths by removing the actually short `/pkg/` element, but it comes with the high price that potentially new project contributors have a significantly longer time to get used to the overall repository and code structure or even discourages them to contribute to the project at all. Therefore a simple package import path of just five additional characters is not a disadvantage at all but also comes with clear way to communicate the purpose of the code. @@ -7,11 +7,11 @@ Note that the usage of the `/pkg` directory also always depends on the use case, ## Directory Structure -The layout always depends on the individual use case(s) of the project, but there are some best practices and great resources like [package naming][go-doc-eff_go#pkg_names] and [style guidelines for Go packages][blog-rakyll-stg_pkgs]. +The layout always depends on the individual use case(s) of the project, but there are some best practices and great resources like [package naming][17] and [style guidelines for Go packages][2]. ## Example -Given the [example of the `/api` directory][gh-blob-api-readme#example] the structure could be created as follows: +Given the [example of the `/api` directory][5] the structure could be created as follows: ```raw pkg @@ -32,42 +32,42 @@ pkg ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: +Next to the experience with own projects and [golang-standards/project-layout][1], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: -- [Kubernetes][gh-kubernetes-tree-pkg] -- [Moby][gh-moby-tree-pkg] -- [etcd][gh-etcd-tree-pkg] -- [Knative][gh-knative-tree-pkg] -- [Prometheus][gh-prometheus-tree-pkg] -- [Grafana][gh-grafana-tree-pkg] -- [gVisor][gh-gvisor-tree-pkg] -- [ArgoCD][gh-argocd-tree-pkg] -- [Jaeger][gh-jaeger-tree-pkg] -- [Helm][gh-helm-tree-pkg] -- [MinIO][gh-minio-tree-pkg] +- [Kubernetes][12] +- [Moby][14] +- [etcd][6] +- [Knative][11] +- [Prometheus][15] +- [Grafana][7] +- [gVisor][8] +- [ArgoCD][4] +- [Jaeger][10] +- [Helm][9] +- [MinIO][13] Blog posts, videos and documentations: -- [Blog Post: “I’ll take pkg over internal“][blog-travisjeffery-pkg_over_int] -- [YouTube: “GopherCon EU 2018: Peter Bourgon - Best Practices for Industrial Programming“][yt-pte4vjidhpg] -- [YouTube: “GopherCon 2018: Kat Zien - How Do You Structure Your Go Apps“][yt-ol6jbuk6tj0] +- [Blog Post: “I’ll take pkg over internal“][3] +- [YouTube: “GopherCon EU 2018: Peter Bourgon - Best Practices for Industrial Programming“][19] +- [YouTube: “GopherCon 2018: Kat Zien - How Do You Structure Your Go Apps“][18] -[blog-rakyll-stg_pkgs]: https://rakyll.org/style-packages -[blog-travisjeffery-pkg_over_int]: https://travisjeffery.com/b/2019/11/i-ll-take-pkg-over-internal -[gh-argocd-tree-pkg]: https://github.com/argoproj/argo-cd/tree/master/pkg -[gh-blob-api-readme#example]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example -[gh-etcd-tree-pkg]: https://github.com/etcd-io/etcd/tree/master/pkg -[gh-grafana-tree-pkg]: https://github.com/grafana/grafana/tree/master/pkg -[gh-gvisor-tree-pkg]: https://github.com/google/gvisor/tree/master/pkg -[gh-helm-tree-pkg]: https://github.com/helm/helm/tree/master/pkg -[gh-jaeger-tree-pkg]: https://github.com/jaegertracing/jaeger/tree/master/pkg -[gh-knative-tree-pkg]: https://github.com/knative/serving/tree/master/pkg -[gh-kubernetes-tree-pkg]: https://github.com/kubernetes/kubernetes/tree/master/pkg -[gh-minio-tree-pkg]: https://github.com/minio/minio/tree/master/pkg -[gh-moby-tree-pkg]: https://github.com/moby/moby/tree/master/pkg -[gh-prometheus-tree-pkg]: https://github.com/prometheus/prometheus/tree/master/pkg -[gh-tree-internal]: https://github.com/svengreb/tmpl-go/tree/main/internal -[go-doc-eff_go#pkg_names]: https://golang.org/doc/effective_go.html#package-names -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout -[yt-ol6jbuk6tj0]: https://www.youtube.com/watch?v=oL6JBUk6tj0 -[yt-pte4vjidhpg]: https://www.youtube.com/watch?v=PTE4VJIdHPg +[1]: https://github.com/golang-standards/project-layout +[2]: https://rakyll.org/style-packages +[3]: https://travisjeffery.com/b/2019/11/i-ll-take-pkg-over-internal +[4]: https://github.com/argoproj/argo-cd/tree/master/pkg +[5]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example +[6]: https://github.com/etcd-io/etcd/tree/master/pkg +[7]: https://github.com/grafana/grafana/tree/master/pkg +[8]: https://github.com/google/gvisor/tree/master/pkg +[9]: https://github.com/helm/helm/tree/master/pkg +[10]: https://github.com/jaegertracing/jaeger/tree/master/pkg +[11]: https://github.com/knative/serving/tree/master/pkg +[12]: https://github.com/kubernetes/kubernetes/tree/master/pkg +[13]: https://github.com/minio/minio/tree/master/pkg +[14]: https://github.com/moby/moby/tree/master/pkg +[15]: https://github.com/prometheus/prometheus/tree/master/pkg +[16]: https://github.com/svengreb/tmpl-go/tree/main/internal +[17]: https://golang.org/doc/effective_go.html#package-names +[18]: https://www.youtube.com/watch?v=oL6JBUk6tj0 +[19]: https://www.youtube.com/watch?v=PTE4VJIdHPg diff --git a/test/README.md b/test/README.md index deaddb3..13e0214 100644 --- a/test/README.md +++ b/test/README.md @@ -4,7 +4,7 @@ Additional external test applications and test data. Feel free to structure the ## Directory Structure -The layout always depends on the individual use case(s) of the project, but there are resources like the official documentations of the [`go test` command][go-doc-cmd-test], which includes information about directories named `testdata`, and about [package lists and patterns][go-doc-cmd-go#pkg_list_pattern]. +The layout always depends on the individual use case(s) of the project, but there are resources like the official documentations of the [`go test` command][10], which includes information about directories named `testdata`, and about [package lists and patterns][9]. ## Example @@ -33,26 +33,26 @@ test ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: +Next to the experience with own projects and [golang-standards/project-layout][1], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: -- [Knative][gh-knative-tree-test] -- [Kubernetes][gh-kubernetes-tree-test] -- [etcd][gh-etcd-tree-tests] -- [Argo][gh-argo-tree-test] -- [Helm][gh-helm-tree-testdata] -- [GoPass][gh-gopass-tree-tests] +- [Knative][7] +- [Kubernetes][8] +- [etcd][4] +- [Argo][3] +- [Helm][6] +- [GoPass][5] Blog posts, videos and documentations: -- [Blog Post: “Test fixtures in Go“][bp-davecheney-test_fixtures] - -[bp-davecheney-test_fixtures]: https://dave.cheney.net/2016/05/10/test-fixtures-in-go -[gh-argo-tree-test]: https://github.com/argoproj/argo/tree/master/test -[gh-etcd-tree-tests]: https://github.com/etcd-io/etcd/tree/master/tests -[gh-gopass-tree-tests]: https://github.com/gopasspw/gopass/tree/master/tests -[gh-helm-tree-testdata]: https://github.com/helm/helm/tree/master/testdata -[gh-knative-tree-test]: https://github.com/knative/serving/tree/master/test -[gh-kubernetes-tree-test]: https://github.com/kubernetes/kubernetes/tree/master/test -[go-doc-cmd-go#pkg_list_pattern]: https://golang.org/cmd/go/#hdr-Package_lists_and_patterns -[go-doc-cmd-test]: https://golang.org/pkg/cmd/go/internal/test -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout +- [Blog Post: “Test fixtures in Go“][2] + +[1]: https://github.com/golang-standards/project-layout +[2]: https://dave.cheney.net/2016/05/10/test-fixtures-in-go +[3]: https://github.com/argoproj/argo/tree/master/test +[4]: https://github.com/etcd-io/etcd/tree/master/tests +[5]: https://github.com/gopasspw/gopass/tree/master/tests +[6]: https://github.com/helm/helm/tree/master/testdata +[7]: https://github.com/knative/serving/tree/master/test +[8]: https://github.com/kubernetes/kubernetes/tree/master/test +[9]: https://golang.org/cmd/go/#hdr-Package_lists_and_patterns +[10]: https://golang.org/pkg/cmd/go/internal/test diff --git a/web/README.md b/web/README.md index 7c59980..b749e2f 100644 --- a/web/README.md +++ b/web/README.md @@ -1,18 +1,18 @@ -The `/web` directory stores web specific data like [SPA][wikip-spa]s, static websites, web components & packages or server-side rendered templates. These are often build with the [JAMStack][] principles where… +The `/web` directory stores web specific data like [SPA][32]s, static websites, web components & packages or server-side rendered templates. These are often build with the [JAMStack][4] principles where… -- …the content is written in formats like [Markdown][wikip-md] or [MDX][] and, depending on the project scope and technology stack, require a preprocessor. -- …the actual applications or web-based documentation are built with [static site generators][jamstack-gens] like [Gatsby][], [Next.js][] or [Hugo][] that leverage reactive UI design through libraries like [React][] and dynamic styling with [styled components][styled-components]. -- …the data is fetched from APIs, often built on top of [GraphQL][], and rendered into templates and customizable data structures through a headless CMS like [TinaCMS][] or [Directus][] so that even non-tech-savvy people can edit and create content. +- …the content is written in formats like [Markdown][31] or [MDX][5] and, depending on the project scope and technology stack, require a preprocessor. +- …the actual applications or web-based documentation are built with [static site generators][28] like [Gatsby][1], [Next.js][6] or [Hugo][3] that leverage reactive UI design through libraries like [React][8] and dynamic styling with [styled components][9]. +- …the data is fetched from APIs, often built on top of [GraphQL][2], and rendered into templates and customizable data structures through a headless CMS like [TinaCMS][10] or [Directus][11] so that even non-tech-savvy people can edit and create content. -See references like the [JAMStack][] documentations for more details. +See references like the [JAMStack][4] documentations for more details. ## Directory Structure -The layout often depends on the individual use case(s) of the project, but it is a good practice to structure it as [monorepo][trunkbasedev-monorepos] by using [Yarn][yarn-docs-ws] or [NPM][npm-docs-cli-v7-ws] workspaces to store and manage multiple packages and applications. This template repository provides a basic workspace setup that is configured in the [`package.json` file][gh-blob-package.json]. +The layout often depends on the individual use case(s) of the project, but it is a good practice to structure it as [monorepo][30] by using [Yarn][33] or [NPM][29] workspaces to store and manage multiple packages and applications. This template repository provides a basic workspace setup that is configured in the [`package.json` file][14]. ## Example -Given the API defined in the [example of the `/api` directory][gh-blob-api-readme#example] the structure could be created as follows: +Given the API defined in the [example of the `/api` directory][13] the structure could be created as follows: ```raw web @@ -59,48 +59,48 @@ web ## References -Next to the experience with own projects and [golang-standards/project-layout][], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: +Next to the experience with own projects and [golang-standards/project-layout][12], many other large, production-grade and well-known projects of the Go ecosystem have been used as references: -- [Consul][gh-consul-tree-ui] ([Website][gh-consul-tree-website]) -- [Vault][gh-vault-tree-ui] ([Website][gh-vault-tree-website]) -- [Nomad][gh-nomad-tree-ui] ([Website][gh-nomad-tree-website]) -- [Drone][gh-drone-tree-web] -- [Traefik][gh-traefik-tree-webui] -- [Prometheus][gh-prometheus-tree-web] -- [PhotoPrism][gh-photoprism-tree-frontend] -- [GitLab][gl-gitlab-tree-app] -- [Gitea][gh-gitea-tree-web_src] -- [Satellity][gh-satellity-tree-app] +- [Consul][15] ([Website][16]) +- [Vault][25] ([Website][26]) +- [Nomad][19] ([Website][20]) +- [Drone][17] +- [Traefik][24] +- [Prometheus][22] +- [PhotoPrism][21] +- [GitLab][27] +- [Gitea][18] +- [Satellity][23] -[directus]: https://directus.io -[gatsby]: https://www.gatsbyjs.com -[gh-blob-api-readme#example]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example -[gh-blob-package.json]: https://github.com/svengreb/tmpl-go/blob/main/package.json -[gh-consul-tree-ui]: https://github.com/hashicorp/consul/tree/master/ui -[gh-consul-tree-website]: https://github.com/hashicorp/consul/tree/master/website -[gh-drone-tree-web]: https://github.com/drone/drone/tree/master/web -[gh-gitea-tree-web_src]: https://github.com/go-gitea/gitea/tree/master/web_src -[gh-nomad-tree-ui]: https://github.com/hashicorp/nomad/tree/master/ui -[gh-nomad-tree-website]: https://github.com/hashicorp/nomad/tree/master/website -[gh-photoprism-tree-frontend]: https://github.com/photoprism/photoprism/tree/develop/frontend -[gh-prometheus-tree-web]: https://github.com/prometheus/prometheus/tree/master/web -[gh-satellity-tree-app]: https://github.com/satellity/satellity/tree/master/app -[gh-traefik-tree-webui]: https://github.com/traefik/traefik/tree/master/webui -[gh-vault-tree-ui]: https://github.com/hashicorp/vault/tree/master/ui -[gh-vault-tree-website]: https://github.com/hashicorp/vault/tree/master/website -[gl-gitlab-tree-app]: https://gitlab.com/gitlab-org/gitlab/-/tree/master/app -[golang-standards/project-layout]: https://github.com/golang-standards/project-layout -[graphql]: https://graphql.org -[hugo]: https://gohugo.io -[jamstack-gens]: https://jamstack.org/generators -[jamstack]: https://jamstack.org -[mdx]: https://mdxjs.com -[next.js]: https://jamstack.org/generators/next -[npm-docs-cli-v7-ws]: https://docs.npmjs.com/cli/v7/using-npm/workspaces -[react]: https://reactjs.org -[styled-components]: https://styled-components.com -[tinacms]: https://tinacms.org -[trunkbasedev-monorepos]: https://trunkbaseddevelopment.com/monorepos -[wikip-md]: https://en.wikipedia.org/wiki/Markdown -[wikip-spa]: https://en.wikipedia.org/wiki/Single-page_application -[yarn-docs-ws]: https://classic.yarnpkg.com/docs/workspaces +[1]: https://www.gatsbyjs.com +[2]: https://graphql.org +[3]: https://gohugo.io +[4]: https://jamstack.org +[5]: https://mdxjs.com +[6]: https://jamstack.org/generators/next +[8]: https://reactjs.org +[9]: https://styled-components.com +[10]: https://tinacms.org +[11]: https://directus.io +[12]: https://github.com/golang-standards/project-layout +[13]: https://github.com/svengreb/tmpl-go/blob/main/api/README.md#example +[14]: https://github.com/svengreb/tmpl-go/blob/main/package.json +[15]: https://github.com/hashicorp/consul/tree/master/ui +[16]: https://github.com/hashicorp/consul/tree/master/website +[17]: https://github.com/drone/drone/tree/master/web +[18]: https://github.com/go-gitea/gitea/tree/master/web_src +[19]: https://github.com/hashicorp/nomad/tree/master/ui +[20]: https://github.com/hashicorp/nomad/tree/master/website +[21]: https://github.com/photoprism/photoprism/tree/develop/frontend +[22]: https://github.com/prometheus/prometheus/tree/master/web +[23]: https://github.com/satellity/satellity/tree/master/app +[24]: https://github.com/traefik/traefik/tree/master/webui +[25]: https://github.com/hashicorp/vault/tree/master/ui +[26]: https://github.com/hashicorp/vault/tree/master/website +[27]: https://gitlab.com/gitlab-org/gitlab/-/tree/master/app +[28]: https://jamstack.org/generators +[29]: https://docs.npmjs.com/cli/v7/using-npm/workspaces +[30]: https://trunkbaseddevelopment.com/monorepos +[31]: https://en.wikipedia.org/wiki/Markdown +[32]: https://en.wikipedia.org/wiki/Single-page_application +[33]: https://classic.yarnpkg.com/docs/workspaces