Skip to content

mpapenbr/go-racelogger

Repository files navigation

go-racelogger

Build Status Security: bandit Dependencies Status Semantic Versioning License Go v1.20

Racelogger for iRacelog project

Initial Setup

This section is intended to help developers and contributors get a working copy of go-racelogger on their end

Clone this repository
git clone https://github.com/mpapenbr/go-racelogger
cd go-racelogger
Option: Do you own setup

Install golangci-lint from the official website for your OS


Local Development

This section will guide you to setup a fully-functional local copy of go-racelogger on your end and teach you how to use it! Make sure you have installed golangci-lint before following this section!

Note: This section relies on the usage of Makefile. If you can't (or don't) use Makefile, you can follow along by running the internal commands from go-racelogger's Makefile (most of which are OS-independent)!

Installing dependencies

To install all dependencies associated with go-racelogger, run the command

make install

Using Code Formatters

Code formatters format your code to match pre-decided conventions. To run automated code formatters, use the Makefile command

make codestyle

Using Code Linters

Linters are tools that analyze source code for possible errors. This includes typos, code formatting, syntax errors, calls to deprecated functions, potential security vulnerabilities, and more!

To run pre-configured linters, use the command

make lint

Running Tests

Tests in go-racelogger are classified as fast and slow - depending on how quick they are to execute.

To selectively run tests from either test group, use the Makefile command

make fast-test

OR

make slow-test

Alternatively, to run the complete test-suite -- i.e. fast and slow tests at one go, use the command

make test

Running the Test-Suite

The test-suite is simply a wrapper to run linters, stylecheckers and all tests at once!

To run the test-suite, use the command

make test-suite

In simpler terms, running the test-suite is a combination of running linters and all tests one after the other!

Additional Resources

Makefile help

Tap for a list of Makefile commands
Command Description Prerequisites
help Generate help dialog listing all Makefile commands with description NA

| install | Fetch project dependencies | NA | | codestyle | Run code-formatters | golangci-lint | | lint | Check codestyle and run linters | golangci-lint | | test | Run all tests | NA | | fast-tests | Selectively run fast tests | NA | | slow-tests | Selectively run slow tests | NA | | test-suite | Check codestyle, run linters and all tests | golangci-lint | | run | Run go-racelogger | NA |


Optionally, to see a list of all Makefile commands, and a short description of what they do, you can simply run

make

Which is equivalent to;

make help

Both of which will list out all Makefile commands available, and a short description of what they do!

Generating Binaries

To generate binaries for multiple OS/architectures, simply run

goreleaser build

The command will generate binaries for Linux, Windows and Mac targetting multiple architectures at once! The binaries, once generated will be stored in the dist directory inside the project directory.

Adjust the .goreleaser.yml to fit your needs.

See goreleaser for details.

Generating Images

goreleaser is also used to create archives and docker images. This can be done by

goreleaser release

The current .goreleaser.yml is target for creating docker images and artefacts to be created by Github actions.

Running go-racelogger

To run go-racelogger, use the command

make run

Additionally, you can pass any additional command-line arguments (if needed) as the argument "q". For example;

make run q="--help"

OR

make run q="--version"

Releases

You can check out a list of previous releases on the Github Releases page.

Semantic versioning with Release Drafter

What is Semantic Versioning?

Semantic versioning is a versioning scheme aimed at making software management easier. Following semantic versioning, version identifiers are divided into three parts;

    <major>.<minor>.<patch>

MAJOR version when you make incompatible API changes [breaking changes]
MINOR version when you add functionality in a backwards compatible manner [more features]
PATCH version when you make backwards compatible bug fixes [bug fixes and stuff]

For a more detailed description, head over to semver.org

Release Drafter automatically updates the release version as pull requests are merged.

Labels allowed;

  • major: Affects the <major> version number for semantic versioning
  • minor, enhancement, update, feature: Affects the <minor> version number for semantic versioning
  • all other labels affect the <patch> version number

Whenever a pull request with one of these labels is merged to the master branch, the corresponding version number will be bumped by one digit!

List of Labels

Pull requests once merged, will be classified into categories by release-drafter based on pull request labels

This is managed by the release-drafter.yml config file.

Label Title in Releases
security 🔒 Security
enhancement, feature, update 🚀 Updates
bug, bugfix, fix 🐛 Bug Fixes
documentation, docs 📝 Documentation
wip, in-progress, incomplete, partial, hotfix 🚧 Work in Progress
dependencies, dependency 📦 Dependencies
refactoring, refactor, tests, testing 🧪 Tests and Refactor
build, ci, pipeline 🤖 CI/CD and Pipelines

The labels bug, enhancement, and documentation are automatically created by Github for repositories. Dependabot will implicitly create the dependencies label with the first pull request raised by it.

The remaining labels can be created as needed!

Credits


go-racelogger is powered by a template generated using cookiecutter-go which is based on go-template

cookiecutter-go-link go-template