Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix commands and live-reloading configuration for development environment #20

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "build"

[build]
args_bin = []
bin = "./build/discord-service"
cmd = "go build -o build/discord-service main.go"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata", "bin", "build"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
main_only = false
time = false

[misc]
clean_on_exit = false

[proxy]
app_port = 0
enabled = false
proxy_port = 0

[screen]
clear_on_rebuild = false
keep_scroll = true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.vscode
coverage.html
coverage.out
build
tmp
build
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
air:
dev:
@echo "Running the Go project using Air..."
air

run:
@air
build:
@echo "Building the Go Project...."
@go build -o build/discord-service
run:build
@echo "Running the Go project..."
go run .
@./build/discord-service

ngrok:
@echo "Running the Go project using Ngrok..."
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This document provides instructions on how to set up and run the Go project usin

- Go 1.18+
- Make
- Air (for `make air`)
- Air (for `make dev`)
- Ngrok (for `make ngrok`)

Ensure you have these dependencies installed before running the commands.
Expand Down Expand Up @@ -89,7 +89,7 @@ You can run the project using the `Makefile`, which provides several commands fo
4. **Running the Project Using Air**

```bash
make air
make dev
```

## Run the Project Using Docker
Expand Down Expand Up @@ -128,7 +128,7 @@ You can run the project using the `Docker`, using the following steps
3. **To automatically re-run the application on changes**:

```bash
make air #or air
make dev #or air
```

4. **To clean up the generated files**:
Expand Down