Popularity
5.4
Growing
Activity
7.6
Declining
215
5
20

Programming language: Shell
License: The Unlicense
Latest version: v0.15.0

golang-templates/seed alternatives and similar packages

Based on the "Project Layout" category.
Alternatively, view golang-templates/seed alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of golang-templates/seed or a related project?

Add another 'Project Layout' Package

README

Go Repository Template

[Keep a Changelog](CHANGELOG.md) GitHub Release Go Reference [go.mod](go.mod) [LICENSE](LICENSE) Build Status Go Report Card Codecov

This is a GitHub repository template for Go. It has been created for ease-of-use for anyone who wants to:

  • quickly get into Go without losing too much time on environment setup,
  • create a new repoisitory with basic Continous Integration.

It includes:

Star this repository if you find it valuable and worth maintaining.

Watch this repository to get notified about new releases, issues, etc.

Usage

  1. Sign up on Codecov and configure Codecov GitHub Application for all repositories.
  2. Click the Use this template button (alt. clone or download this repository).
  3. Replace all occurences of golang-templates/seed to your_org/repo_name in all files.
  4. Replace all occurences of seed to repo_name in [Dockerfile](Dockerfile).
  5. Update the following files:
    • [CHANGELOG.md](CHANGELOG.md)
    • [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)
    • [LICENSE](LICENSE)
    • [README.md](README.md)

Setup

Below you can find sample instructions on how to set up the development environment. Of course you can use other tools like GoLand, Vim, Emacs. However take notice that the Visual Studio Go extension is officially supported by the Go team.

Local Machine

Follow these steps if you are OK installing and using Go on your machine.

  1. Install Go.
  2. Install Visual Studio Code.
  3. Install Go extension.
  4. Clone and open this repository.
  5. F1 -> Go: Install/Update Tools -> (select all) -> OK.

Development Container

Follow these steps if you do not want to install Go on your machine and you prefer to use a Development Container instead.

  1. Install Visual Studio Code.
  2. Follow Developing inside a Container - Getting Started.
  3. Clone and open this repository.
  4. F1 -> Remote-Containers: Reopen in Container.
  5. F1 -> Go: Install/Update Tools -> (select all) -> OK.

The Development Container configuration mixes Docker in Docker and Go definitions. Thanks to it you can use go, docker, docker-compose inside the container.

Build

Terminal

  • make - execute the build pipeline.
  • make help - print help for the [Make targets](Makefile).

Visual Studio Code

F1Tasks: Run Build Task (Ctrl+Shift+B or ⇧⌘B) to execute the build pipeline.

Release

The release workflow is triggered each time a tag with v prefix is pushed.

CAUTION: Make sure to understand the consequences before you bump the major version. More info: Go Wiki, Go Blog.

Maintainance

Remember to update Go version in [.github/workflows](.github/workflows), [Makefile](Makefile) and [devcontainer.json](.devcontainer/devcontainer.json).

Notable files:

  • [devcontainer.json](.devcontainer/devcontainer.json) - Visual Studio Code Remote Container configuration,
  • [.github/workflows](.github/workflows) - GitHub Actions workflows,
  • [.github/dependabot.yml](.github/dependabot.yml) - Dependabot configuration,
  • [.vscode](.vscode) - Visual Studio Code configuration files,
  • [.golangci.yml](.golangci.yml) - golangci-lint configuration,
  • [.goreleaser.yml](.goreleaser.yml) - GoReleaser configuration,
  • [Dockerfile](Dockerfile) - Dockerfile used by GoReleaser to create a container image,
  • [Makefile](Makefile) - Make targets used for development, [CI build](.github/workflows) and [.vscode/tasks.json](.vscode/tasks.json),
  • [go.mod](go.mod) - Go module definition,
  • [tools.go](tools.go) - build tools.

FAQ

Why Visual Studio Code editor configuration

Developers that use Visual Studio Code can take advantage of the editor configuration. While others do not have to care about it. Setting configs for each repo is unnecessary time consuming. VS Code is the most popular Go editor (survey) and it is officially supported by the Go team.

You can always remove the [.devcontainer](.devcontainer) and [.vscode](.vscode) directories if it really does not help you.

Why GitHub Actions, not any other CI server

GitHub Actions is out-of-the-box if you are already using GitHub. Here you can learn how to use it for Go.

However, changing to any other CI server should be very simple, because this repository has build logic and tooling installation in [Makefile](Makefile).

How can I build on Windows

Install tdm-gcc and copy C:\TDM-GCC-64\bin\mingw32-make.exe to C:\TDM-GCC-64\bin\make.exe. Alternatively, you may install mingw-w64 and copy mingw32-make.exe accordingly.

Alternatively use WSL (Windows Subsystem for Linux) or develop inside a Remote Container. However, take into consideration that then you are not going to use "bare-metal" Windows.

How can I create an application installation script

  1. Install GoDownloader.

  2. Execute:

    godownloader --repo=your_org/repo_name > ./install.sh
    
  3. Push install.sh to your repository.

  4. Add installation instructions to your README.md e.g.:

    curl -sSfL https://raw.githubusercontent.com/your_org/repo_name/main/install.sh | sh -s -- -b /usr/local/bin
    

How can I customize the release or add deb/rpm/snap packages, Homebrew Tap, Scoop App Manifest etc

Take a look at GoReleaser docs as well as its repo how it is dogfooding its functionality.

How can I create a library instead of an application

You can change the [.goreleaser.yml](.goreleaser.yml) to contain:

build:
  skip: true
release:
  github:
  prerelease: auto

Alternatively, you can completly remove the usage of GoReleaser if you prefer handcrafted release notes. Take a look how it is done in taskflow.

Why the code coverage results are not accurate

By default go test records code coverage for the package that is currently tested. If you want to get more accurate (cross-package) coverage, then consider using go-acc. Read more.

How to automate generating git tags for next release version

Auto-tagging can be done in many ways e.g. by using GitHub Actions like:

However, creating a release tag manually is often the optimal approach. Take notice that this template executes a release workflow each time a git tag with v prefix is pushed.

Contributing

Simply create an issue or a pull request.


*Note that all licence references and agreements mentioned in the golang-templates/seed README section above are relevant to that project's source code only.