Skip to content

Commit 5791725

Browse files
authored
Merge pull request #29 from kaleb110/main
refactor: added robust gitignore file, enhanced make file, renamed .e…
2 parents 6638f92 + f07a342 commit 5791725

File tree

5 files changed

+97
-1
lines changed

5 files changed

+97
-1
lines changed

.air.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = "."
2+
tmp_dir = "bin"
3+
4+
[build]
5+
bin = "bin/main"
6+
cmd = "" # Prevent building, just restart the server
7+
log = "debug"
8+
include = ["*.go"]
9+
exclude = ["tmp", "vendor"]
10+
11+
[color]
12+
main = "yellow"
13+
watcher = "cyan"
14+
build = "green"
15+
log = "white"

.env renamed to .env.example

File renamed without changes.

.gitignore

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
17

2-
dist/
8+
# Output of the go coverage tool, specifically when using LiteIDE
9+
*.out
10+
11+
# Dependency directories (remove the comment below if you use Go modules)
12+
vendor/
13+
14+
# Go workspace file
15+
go.work
16+
go.work.sum
17+
18+
# IDE/editor specific files
19+
.vscode/
20+
.idea/
21+
*.swp
22+
23+
# Environment variable file
24+
.env
25+
26+
# Ignore the tmp directory and all files inside it
27+
/tmp

Makefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
11
run:
22
@go build -o ./bin/main .
33
@./bin/main
4+
5+
# Simple Makefile for a Go project
6+
7+
# Build the application
8+
all: build test
9+
10+
build:
11+
@echo "Building..."
12+
@go build -o ./bin/main.go
13+
14+
# Run the application
15+
run:
16+
@echo "Running..."
17+
@go run ./bin/main.go
18+
19+
# Create DB container
20+
docker-run:
21+
@echo "Starting Docker container..."
22+
@$(if $(shell command -v docker compose 2>/dev/null), docker compose, docker-compose) up --build
23+
24+
# Shutdown DB container
25+
docker-down:
26+
@echo "Stopping Docker container..."
27+
@$(if $(shell command -v docker compose 2>/dev/null), docker compose, docker-compose) down
28+
29+
# Test the application
30+
test:
31+
@echo "Testing..."
32+
@go test ./... -v
33+
34+
# Clean the binary
35+
clean:
36+
@echo "Cleaning..."
37+
@rm -f ./bin/main
38+
39+
# Live Reload
40+
watch:
41+
@echo "Watching for changes..."
42+
@$(if $(shell command -v air 2>/dev/null), air, \
43+
$(if $(shell read -p "Go's 'air' is not installed. Do you want to install it? [Y/n] " choice; \
44+
[ "$$choice" != "n" ] && [ "$$choice" != "N" ]), \
45+
go install github.com/air-verse/air@latest && air, \
46+
echo "You chose not to install air. Exiting..." && exit 1))
47+
48+
.PHONY: all build run test clean watch docker-run docker-down

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ Manaul✌️:
5151
go mod tidy
5252
go run main.go
5353
```
54+
or- live refresh with air.
55+
56+
- install air
57+
```bash
58+
go install github.com/air-verse/air@latest
59+
```
60+
- then run:
61+
```bash
62+
air
63+
```
64+
5465
3-In root frontend directory you should run your next project
5566
```bash
5667
yarn install

0 commit comments

Comments
 (0)