Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a63cff4
chore: bump go to 1.23 (#650)
Sep 21, 2024
90c8f9e
docs: update banner (#651)
Sep 21, 2024
f4f7c3d
fix proxy retry loop (#635)
farmergreg Sep 21, 2024
6761441
Use web page address when making request to reload proxy (#625)
yopoyka Sep 21, 2024
b9384e5
fix the stop_on_error is false configuration does not work (#555)
pyjcode Sep 21, 2024
16db632
fix color output (#551)
8LWXpg Sep 21, 2024
7187d7f
Set the Via header in proxy requests to origin and in client response…
dedalusj Sep 22, 2024
c75a2f5
feat: Make include_file overrule include_ext, fixes: #350, base_on: #…
zhb127 Sep 22, 2024
9f5042d
fix: broken code (#652)
Sep 22, 2024
0dfcd29
feat: silent flag in .air.toml, suppressing all air prints (#641)
jesses-code-adventures Sep 25, 2024
df13da5
FIX: Support working directories containing whitespace (#646)
osteensco Oct 9, 2024
27096db
Revert "FIX: Support working directories containing whitespace (#646)…
Oct 16, 2024
6c02409
refactor: remove unnecessary var copy in for (#682)
alexandear Nov 6, 2024
7547fc6
docs: fix badge link in README-zh_cn.md (#681)
alexandear Nov 6, 2024
2c1bccf
refactor: simplify test asserts; enable testifylint (#680)
alexandear Nov 7, 2024
8fadfe6
Update unclear .profile changes in README.md (#684)
gorvk Nov 11, 2024
7019f7a
Fix: typo in air_example.toml (#706)
oliviaBahr Nov 21, 2024
6511c41
Implement kill delay on Windows (#552)
8LWXpg Dec 16, 2024
7a0a17f
Handle absolute paths in config (#318)
ZipFile Dec 16, 2024
e0851cb
remove a data race by compiling the exclude regexes in the preprocess…
istyf Dec 16, 2024
8fae31c
catch and report start cmd failure rather than panicing (#676)
istyf Dec 16, 2024
785da24
chore: fix test case TestRegexes
xiantang Dec 16, 2024
c8498c2
air -h will be document of air
xiantang Dec 16, 2024
2186c12
Update README for air help command
xiantang Dec 16, 2024
0232344
fix: default config override (#719)
nemanja-m Dec 17, 2024
a4539f6
Avoid duplicating cors header. (#727)
brandonbloom Jan 17, 2025
4be5540
fix: typos (#728)
NathanBaulch Jan 17, 2025
ad99709
wait for killfunc completion when shutting down current app (#670)
istyf Jan 19, 2025
0811477
Feature: Show build errors when using proxy (#725)
Polo123456789 Jan 19, 2025
ad8fbb7
Add exiter to test os.Exit case (#729)
xiantang Jan 19, 2025
1068416
Fix: using powershell instead of cmd /C (#708)
n1vk Jan 23, 2025
b897770
Merge branch 'master' of github.com:air-verse/air into air-verse-master
wafer-bw Jan 31, 2025
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
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
uses: actions/checkout@v4
- name: Setup Go
id: go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
go-version: ^1.23
- name: Install golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
version: v1.61
- name: Install dependency
run: if [ $(uname) == "Darwin" ]; then brew install gnu-sed ;fi
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
go-version: ^1.23

- name: Set GOVERSION
run: echo "GOVERSION=$(go version | sed -r 's/go version go(.*)\ .*/\1/')" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/smoke_test_reuse_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
uses: actions/checkout@v4
- name: Setup Go
id: go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
go-version: ^1.23
- name: Install
run: make install
- name: Check rebuild
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smoke_test_reuse_job_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
id: go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
go-version: ^1.23
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ run:
linters:
disable-all: true
enable:
- copyloopvar # detects places where loop variables are copied
- errcheck # Errcheck is a program for checking for unchecked errors in go programs.
- gci # Gci controls Go package import order and makes it always deterministic
- goimports # checks that goimports was run
Expand All @@ -12,5 +13,6 @@ linters:
- revive # configurable linter for Go. Drop-in replacement of golint
- staticcheck # go vet on steroids
- stylecheck # static analysis, finds bugs and performance issues, offers simplifications, and enforces style rules
- testifylint # checks usage of github.com/stretchr/testify
- unconvert # Remove unnecessary type conversions
- unused # Checks Go code for unused constants, variables, functions and types
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ LABEL maintainer="Rick Yu <cosmtrek@gmail.com>"
ENV GOPATH /go
ENV GO111MODULE on

COPY . /go/src/github.com/cosmtrek/air
WORKDIR /go/src/github.com/cosmtrek/air
COPY . /go/src/github.com/air-verse/air
WORKDIR /go/src/github.com/air-verse/air

RUN --mount=type=cache,target=/go/pkg/mod go mod download

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LDFLAGS += -X "main.airVersion=$(AIRVER)"
LDFLAGS += -X "main.goVersion=$(shell go version | sed -r 's/go version go(.*)\ .*/\1/')"

GO := GO111MODULE=on CGO_ENABLED=0 go
GOLANGCI_LINT_VERSION = v1.60.3
GOLANGCI_LINT_VERSION = v1.61.0

.PHONY: init
init: install-golangci-lint
Expand Down
25 changes: 12 additions & 13 deletions README-zh_cn.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Air [![Go](https://github.com/air-verse/air/workflows/Go/badge.svg)](https://github.com/air-verse/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/air-verse/air/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=air-verse/air&amp;utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/air-verse/air)](https://goreportcard.com/report/github.com/air-verse/air) [![codecov](https://codecov.io/gh/air-verse/air/branch/master/graph/badge.svg)](https://codecov.io/gh/air-verse/air)
# Air [![Go](https://github.com/air-verse/air/actions/workflows/release.yml/badge.svg)](https://github.com/air-verse/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/air-verse/air/dashboard?utm_source=github.com&utm_medium=referral&utm_content=air-verse/air&utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/air-verse/air)](https://goreportcard.com/report/github.com/air-verse/air) [![codecov](https://codecov.io/gh/air-verse/air/branch/master/graph/badge.svg)](https://codecov.io/gh/air-verse/air)

:cloud: 热重载 Go 应用的工具

Expand All @@ -16,11 +16,11 @@ Air 是为 Go 应用开发设计的另外一个热重载的命令行工具。只

## 特色

* 彩色的日志输出
* 自定义构建或必要的命令
* 支持外部子目录
* 在 Air 启动之后,允许监听新创建的路径
* 更棒的构建过程
- 彩色的日志输出
- 自定义构建或必要的命令
- 支持外部子目录
- 在 Air 启动之后,允许监听新创建的路径
- 更棒的构建过程

### 使用参数覆盖指定配置

Expand All @@ -42,7 +42,7 @@ air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build

### 使用 `go install` (推荐)

使用 go 1.22 或更高版本:
使用 go 1.23 或更高版本:

```shell
go install github.com/air-verse/air@latest
Expand All @@ -60,7 +60,6 @@ curl -sSfL https://raw.githubusercontent.com/air-verse/air/master/install.sh | s
air -v
```


### 使用 [goblin.run](https://goblin.run)

```shell
Expand Down Expand Up @@ -122,6 +121,7 @@ AIR_PORT=8080 air -c "config.toml"
```

这将用当前目录替换 `$PWD`,`$AIR_PORT` 是要发布的端口,而 `$@` 用于接受应用程序本身的参数,例如 `-c`

</details>

## 使用方法
Expand Down Expand Up @@ -205,7 +205,7 @@ services:

```Dockerfile
# 选择你想要的版本,>= 1.16
FROM golang:1.22-alpine
FROM golang:1.23-alpine

WORKDIR /app

Expand Down Expand Up @@ -259,12 +259,11 @@ export PATH=$PATH:$(go env GOPATH)/bin <---- 请确认这行在您的配置信

### 如何在静态文件更改时自动重新加载浏览器?


请参考 [#512](https://github.com/cosmtrek/air/issues/512).

* 确保你的静态文件在 `include_dir`、`include_ext` 或 `include_file` 中。
* 确保你的 HTML 有一个 `</body>` 标签。
* 通过配置以下内容开启代理:
- 确保你的静态文件在 `include_dir`、`include_ext` 或 `include_file` 中。
- 确保你的 HTML 有一个 `</body>` 标签。
- 通过配置以下内容开启代理:

```toml
[proxy]
Expand Down
14 changes: 7 additions & 7 deletions README-zh_tw.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# :cloud: Air - Live reload for Go apps

[![Go](https://github.com/air-verse/air/actions/workflows/release.yml/badge.svg)](https://github.com/air-verse/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/air-verse/air/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=air-verse/air&amp;utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/air-verse/air)](https://goreportcard.com/report/github.com/air-verse/air) [![codecov](https://codecov.io/gh/air-verse/air/branch/master/graph/badge.svg)](https://codecov.io/gh/air-verse/air)
[![Go](https://github.com/air-verse/air/actions/workflows/release.yml/badge.svg)](https://github.com/air-verse/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/air-verse/air/dashboard?utm_source=github.com&utm_medium=referral&utm_content=air-verse/air&utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/air-verse/air)](https://goreportcard.com/report/github.com/air-verse/air) [![codecov](https://codecov.io/gh/air-verse/air/branch/master/graph/badge.svg)](https://codecov.io/gh/air-verse/air)

![air](docs/air.png)

Expand All @@ -16,11 +16,11 @@ Air 是一個另類的自動重新編譯執行命令列工具,用於開發 Go

## 功能列表

* 彩色的日誌輸出
* 自訂建立或任何命令
* 支援排除子目錄
* 允許在 Air 開始後監視新目錄
* 更佳的建置過程
- 彩色的日誌輸出
- 自訂建立或任何命令
- 支援排除子目錄
- 允許在 Air 開始後監視新目錄
- 更佳的建置過程

### 用參數覆寫指定的配置

Expand All @@ -42,7 +42,7 @@ air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build

### 使用 `go install` (推薦)

需要使用 go 1.22 或更高版本:
需要使用 go 1.23 或更高版本:

```bash
go install github.com/air-verse/air@latest
Expand Down
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# :cloud: Air - Live reload for Go apps

[![Go](https://github.com/air-verse/air/actions/workflows/release.yml/badge.svg)](https://github.com/air-verse/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/air-verse/air/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=air-verse/air&amp;utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/air-verse/air)](https://goreportcard.com/report/github.com/air-verse/air) [![codecov](https://codecov.io/gh/air-verse/air/branch/master/graph/badge.svg)](https://codecov.io/gh/air-verse/air)
[![Go](https://github.com/air-verse/air/actions/workflows/release.yml/badge.svg)](https://github.com/air-verse/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/air-verse/air/dashboard?utm_source=github.com&utm_medium=referral&utm_content=air-verse/air&utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/air-verse/air)](https://goreportcard.com/report/github.com/air-verse/air) [![codecov](https://codecov.io/gh/air-verse/air/branch/master/graph/badge.svg)](https://codecov.io/gh/air-verse/air)

![air](docs/air.png)

Expand All @@ -20,16 +20,26 @@ Note: This tool has nothing to do with hot-deploy for production.

## Features

* Colorful log output
* Customize build or any command
* Support excluding subdirectories
* Allow watching new directories after Air started
* Better building process
- Colorful log output
- Customize build or any command
- Support excluding subdirectories
- Allow watching new directories after Air started
- Better building process

### Overwrite specify configuration from arguments

Support air config fields as arguments:

You can view the available command-line arguments by running the following commands:

```
air -h
```
or
```
air --help
```

If you want to config build command and run command, you can use like the following command without the config file:

```shell
Expand All @@ -46,7 +56,7 @@ air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build

### Via `go install` (Recommended)

With go 1.22 or higher:
With go 1.23 or higher:

```bash
go install github.com/air-verse/air@latest
Expand Down Expand Up @@ -209,7 +219,7 @@ services:

```Dockerfile
# Choose whatever you want, version >= 1.16
FROM golang:1.22-alpine
FROM golang:1.23-alpine

WORKDIR /app

Expand Down Expand Up @@ -245,12 +255,12 @@ services:
```shell
export GOPATH=$HOME/xxxxx
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export PATH=$PATH:$(go env GOPATH)/bin <---- Confirm this line in you profile!!!
export PATH=$PATH:$(go env GOPATH)/bin #Confirm this line in your .profile and make sure to source the .profile if you add it!!!
```

### Error under wsl when ' is included in the bin

Should use `\` to escape the `' in the bin. related issue: [#305](https://github.com/air-verse/air/issues/305)
Should use `\` to escape the `'` in the bin. related issue: [#305](https://github.com/air-verse/air/issues/305)

### Question: how to do hot compile only and do not run anything?

Expand All @@ -263,12 +273,11 @@ Should use `\` to escape the `' in the bin. related issue: [#305](https://github

### How to Reload the Browser Automatically on Static File Changes


Refer to issue [#512](https://github.com/air-verse/air/issues/512) for additional details.

* Ensure your static files in `include_dir`, `include_ext`, or `include_file`.
* Ensure your HTML has a `</body>` tag
* Activate the proxy by configuring the following config:
- Ensure your static files in `include_dir`, `include_ext`, or `include_file`.
- Ensure your HTML has a `</body>` tag
- Activate the proxy by configuring the following config:

```toml
[proxy]
Expand Down
12 changes: 7 additions & 5 deletions air_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exclude_regex = ["_test\\.go"]
exclude_unchanged = true
# Follow symlink for directories
follow_symlink = true
# This log file places in your tmp_dir.
# This log file is placed in your tmp_dir.
log = "air.log"
# Poll files for changes instead of using fsnotify.
poll = false
Expand All @@ -58,6 +58,8 @@ rerun_delay = 500
time = false
# Only show main log (silences watcher, build, runner)
main_only = false
# silence all logs produced by air
silent = false

[color]
# Customize each part's color. If no color found, use the raw app log.
Expand All @@ -74,8 +76,8 @@ clean_on_exit = true
clear_on_rebuild = true
keep_scroll = true

# Enable live-reloading on the browser.
[proxy]
enabled = true
proxy_port = 8090
app_port = 8080
# Enable live-reloading on the browser.
enabled = true
proxy_port = 8090
app_port = 8080
Binary file modified docs/air.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 24 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,44 @@ module github.com/air-verse/air
go 1.23.5

require (
dario.cat/mergo v1.0.0
github.com/creack/pty v1.1.21
github.com/fatih/color v1.16.0
dario.cat/mergo v1.0.1
github.com/creack/pty v1.1.23
github.com/fatih/color v1.17.0
github.com/fsnotify/fsnotify v1.7.0
github.com/gohugoio/hugo v0.123.3
github.com/gohugoio/hugo v0.134.3
github.com/pelletier/go-toml v1.9.5
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
)

require (
github.com/bep/debounce v1.2.1 // indirect
github.com/bep/godartsass v1.2.0 // indirect
github.com/bep/godartsass/v2 v2.0.0 // indirect
github.com/bep/golibsass v1.1.1 // indirect
github.com/bep/godartsass/v2 v2.1.0 // indirect
github.com/bep/golibsass v1.2.0 // indirect
github.com/bep/gowebp v0.4.0 // indirect
github.com/bep/lazycache v0.5.0 // indirect
github.com/cli/safeexec v1.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/getkin/kin-openapi v0.127.0 // indirect
github.com/gobuffalo/flect v1.0.3 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/tdewolff/parse/v2 v2.7.12 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/tdewolff/parse/v2 v2.7.15 // indirect
github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/image v0.20.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/tools v0.25.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading