Skip to content

Latest commit

 

History

History
109 lines (75 loc) · 3.18 KB

README.md

File metadata and controls

109 lines (75 loc) · 3.18 KB

Story Tracker

Sandbox application for learning the Go programming language.

Getting Started

This section provides some guides on how to stand up your development environment.

Install

This project is written in Go and requires that it be installed prior to development. There are a few ways to install Go on your system. The easiest way is to download the installer from the official Go website. The recommended method is to use a tool like mise-en-place to manage your Go installations. Other methods include using a package manager like brew or apt.

In addition to Go, this project also requires the following tools:

  • sqlc: Generate type-safe Go code from SQL
  • dbmate: Database migration tool
  • just: Tool for running project specific commands
  • air: Live reload tool for Go applications

Environment

This project uses .env files to manage the configuration of the current environment. The .env.template file should be copied and renamed to .env.local and updated with the appropriate values.

Dev Containers

This project provides configurations to be able to stand up your development environment inside a Docker container. This requires a running instance of docker and a tool that supports the development container specification. Some examples are DevPod and VS Code via the Remote Development extension pack.

Building

To build the application, run the following command:

just build

This will generate all go code from SQL and compile the application. The resulting binary will be placed in the bin folder.

To run the application in watch mode, use the following command:

just watch

This will start the application using the air tool, which will automatically reload the application when changes are detected.

Testing

Note

Unit tests are still a work in progress for this project.

To run the tests for the application, use the following command:

just test

Migrations

This application uses the dbmate tool to manage database migrations. To create a new migration, run the following command:

dbmate new <migration_name>

To execute all pending migrations, run the following command:

just migrate-up

To Rollback the last migration, run the following command:

just migrate-down

References