Skip to content

Commit 2e95ad9

Browse files
committed
update air
1 parent b7deccc commit 2e95ad9

File tree

9 files changed

+38
-21
lines changed

9 files changed

+38
-21
lines changed

.air.toml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format
1+
# Config file for [Air](https://github.com/air-verse/air) in TOML format
22

33
# Working directory
44
# . or absolute path, please note that the directories following must be under root.
55
root = "."
66
tmp_dir = ".airtmp"
77

88
[build]
9+
# Array of commands to run before each build
10+
# pre_cmd = ["make dbg.goboilerplate"]
11+
912
# Just plain old shell command. You could use `make` as well.
10-
cmd = "make dbg.goboilerplate" #"make dbg.goboilerplate" # skip build from air since we use dlv debug
13+
cmd = "make dbg.goboilerplate"
14+
15+
# Array of commands to run after ^C
16+
#post_cmd = ["clean"]
17+
1118
# Binary file yields from `cmd`.
12-
bin = "build/dlv" # use dlv wrapper script as "binary"
19+
#bin = "build/dlv" # use dlv wrapper script as "binary"
20+
bin = "output/goboilerplate"
21+
1322
# Customize binary, can setup environment variables when run your app.
1423
#full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"
24+
# Add additional arguments when running binary (bin/full_bin). Will run './tmp/main hello world'.
25+
#args_bin = ["hello", "world"]
1526
# Watch these filename extensions.
1627
include_ext = ["go", "tpl", "tmpl", "html", "mod", "sum"]
1728
# Ignore these filename extensions or directories.
@@ -41,13 +52,11 @@ stop_on_error = true
4152
# Send Interrupt signal before killing process (windows does not support this feature)
4253
send_interrupt = true
4354
# Delay after sending Interrupt signal
44-
kill_delay = 400 # ms
55+
kill_delay = 1000000000 # nanosecond
4556
# Rerun binary or not
4657
rerun = false
47-
# Delay after each executions
48-
rerun_delay = 400
49-
# Add additional arguments when running binary (bin/full_bin). Will run './tmp/main hello world'.
50-
#args_bin = ["hello", "world"]
58+
# Delay after each execution
59+
rerun_delay = 500
5160

5261
[log]
5362
# Show log time
@@ -69,3 +78,9 @@ clean_on_exit = true
6978
[screen]
7079
clear_on_rebuild = false
7180
keep_scroll = true
81+
82+
# Enable live-reloading on the browser.
83+
[proxy]
84+
enabled = true
85+
proxy_port = 8090
86+
app_port = 8080

.vscode/cspell.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// words - list of words to be always considered correct
55
"words": [
66
"CMDNAME",
7-
"cosmtrek",
87
"covermode",
98
"coverprofile",
109
"CURDIR",

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ image:
107107
--output='$(DOCKER_BUILD_OUTPUT)' \
108108
.
109109

110-
DOCKER_COMPOSE_EXEC ?= $(DOCKER_EXEC) compose -f $(CURDIR)/deployments/compose/docker-compose.yml
110+
DOCKER_COMPOSE_EXEC ?= $(DOCKER_EXEC) compose -f $(CURDIR)/deployments/local/docker-compose.yml
111111

112112
.PHONY: compose-up
113113
compose-up:
@@ -164,8 +164,8 @@ test:
164164
checks: vet staticcheck gofumpt goimports golangci-lint-github-actions
165165

166166
.PHONY: run
167-
run: $(TOOLS_BIN)/gojq
168-
$(GO_EXEC) run -mod=vendor ./cmd/goboilerplate | $(TOOLS_BIN)/gojq
167+
run:
168+
$(GO_EXEC) run -mod=vendor ./cmd/goboilerplate
169169

170170
.PHONY: ci-gen-n-format
171171
ci-gen-n-format: goimports gofumpt

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The boilerplate consists of:
77
* [GitHub Actions](https://github.com/features/actions) for linter checks and tests on each pr.
88
* [Dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates) setup for updating dependencies.
99
* [Visual Studio Code](https://code.visualstudio.com/) settings, tasks and launch configuration for building, debugging and testing the code.
10-
* Docker compose and development Dockerfile with hot-rebuild (using [air](https://github.com/cosmtrek/air)) and dlv debug server.
10+
* Docker compose and development Dockerfile with hot-rebuild (using [air](https://github.com/air-verse/air)) and dlv debug server.
1111
* Production Dockerfile
1212

1313
## How to use
@@ -63,7 +63,7 @@ Stops (if started) the containers specified by the docker compose file `deployme
6363
___
6464

6565
#### `air`
66-
Installs (if needed) [air](https://github.com/cosmtrek/air) under `TOOLS_BIN` folder (default is `./.tools/bin`) and runs `air -c .air.toml`. <br>
66+
Installs (if needed) [air](https://github.com/air-verse/air) under `TOOLS_BIN` folder (default is `./.tools/bin`) and runs `air -c .air.toml`. <br>
6767
Air watches for code file changes and rebuilds the binary according to the configuration `.air.toml`. <br>
6868
Current air configuration executes `cmd.goboilerplate` target (on each file change) and then runs the `./build/dlv` that starts the debug server (`dlv exec`) with the produced binary.
6969
___

build/dlv

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dlv \
1+
exec dlv \
22
--listen='0.0.0.0:2345' \
33
--backend="default" \
44
--api-version=2 \
@@ -20,3 +20,6 @@ dlv \
2020
# #--continue
2121
# #--log \
2222
# #--log-output='debugger,rpc,fncall'
23+
24+
# BusyBox ps
25+
# ps -o pid,ppid,pgid,tty,comm,args

build/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# syntax=docker/dockerfile:1.9
1+
# syntax=docker/dockerfile:1.10
22
### https://hub.docker.com/r/docker/dockerfile
33

44
# https://docs.docker.com/build/guide/mounts/

build/docker/debug.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# syntax=docker/dockerfile:1.6
1+
# syntax=docker/dockerfile:1.10
22
### https://hub.docker.com/r/docker/dockerfile
33

44
# https://hub.docker.com/_/golang
@@ -12,7 +12,7 @@ apk update
1212
apk add --no-cache make git bash ca-certificates
1313

1414
go install github.com/go-delve/delve/cmd/dlv@latest
15-
go install github.com/cosmtrek/air@latest
15+
go install github.com/air-verse/air@latest
1616

1717
git config --global --add safe.directory /wd
1818

deployments/compose/docker-compose.yml renamed to deployments/local/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services:
2727
- APP_HTTP_OUTBOUND_TRAFFIC_LOG_LEVEL=2
2828
- APP_HTTP_READ_HEADER_TIMEOUT=3s
2929
- APP_SHUTDOWN_TIMEOUT=6s
30-
- APP_LOG_LEVEL=0
30+
- APP_LOG_LEVEL=DEBUG
3131

3232
# volumes:
3333
# gocache: {}

scripts/tools.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ gojq: $(TOOLS_BIN)/gojq
127127
## </gojq>
128128

129129
## <air>
130-
# https://github.com/cosmtrek/air/releases
131-
AIR_CMD:=github.com/cosmtrek/air
130+
# https://github.com/air-verse/air/releases
131+
AIR_CMD:=github.com/air-verse/air
132132
AIR_VER:=v1.52.3
133133
$(TOOLS_BIN)/air: $(TOOLS_DB)/air.$(AIR_VER).$(GO_VER).ver
134134
$(call go_install,air,$(AIR_CMD),$(AIR_VER))

0 commit comments

Comments
 (0)