Skip to content

Instantly share code, notes, and snippets.

@harmlessprince
Created June 1, 2024 11:24
Show Gist options
  • Save harmlessprince/858ab56b3521d2457f00c1f9984c41e3 to your computer and use it in GitHub Desktop.
Save harmlessprince/858ab56b3521d2457f00c1f9984c41e3 to your computer and use it in GitHub Desktop.
Make File for Golang
# Define the default target
.PHONY: default
default: help
.PHONY: help
help:
@echo "Available targets:"
@echo " seeder FILENAME Process the specified seeder file name"
# application repository and binary file name
NAME=Bougette
# application repository path
REPOSITORY=github.com/projects/${NAME}
install:
go mod download
run-dev:
echo "Starting Application In Development Mode"
gow run ./cmd/api
#go run ./cmd/api
migrate:
echo "Running migrations up"
go run ./internal/database/migrate_up.go
#E.G make seeder FILENAME=category
.PHONY: seeder
seeder:
ifdef FILENAME
echo "Seedinng : $(FILENAME).go"
go run "./internal/database/seeders/$(FILENAME)_seeder.go"
else
echo "Error: FILENAME is not specified. Please provide the filename using 'make seeder FILENAME=<filename>'"
exit 1
endif
migrate_fresh:
echo "Running fresh migrations"
go run ./internal/database/migrate_fresh.go
migrate_down:
go run ./migrations/drop_migrations.go
test:
gotest ./tests/... -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment