/golang-template

Template used to bootstrap GitHub Golang projects at Criteo

Primary LanguageGoApache License 2.0Apache-2.0

Go status CI GitHub

Criteo Golang template

This repository contains the template used to bootstrap GitHub Golang projects at Criteo.

How to bootstrap your own repository

Rename the Go module, and clean the example code:

go mod edit -module <github.com/your-org/your-awesome-project>
rm cmd/example -rf

Set the build details in .goreleaser.yaml:

  - id: example
    binary: example
    main: ./cmd/example
    env:
      - CGO_ENABLED=0
    goos:
      - linux

Continuous Integration

Tests are run automatically on Pull Requests and Push events:

Releases

  • Step 1: push your changes
git add main.go
git commit "feat: adding an awesome feature"
git push
  • Step 2: merge the related PR from the GitHub web UI
  • Step 3: add a new tag
git tags         # get the list of existing tags
git tag v0.0.2   # create a tag on the current local HEAD
git push --tags  # push only the tag to GitHub

You are encouraged to use Semantic Versioning.

Once the tag is pushed, GitHub action will run GoReleaser automatically. GoReleaser will publish a new release with an auto-generated changelog using the commits message.