Skip to content

Commit 786dedc

Browse files
wafer-bwRick Yufarmergregyopoykapyjcode
authored
Merge in upstream changes form air-verse/air (#13)
* chore: bump go to 1.23 (air-verse#650) * docs: update banner (air-verse#651) * fix proxy retry loop (air-verse#635) This addresses two bugs: 1) The loop could exit with an error condition present and fail to inform the user. 2) On Windows 11, syscall.ECONNREFUSED is not returned. Instead we receive net.OpError with a message similar to: "unable to reach app: Get "http://localhost:7000/": dial tcp [::1]:7000: connectex: No connection could be made because the target machine actively refused it." The Fix: Since the retry loop is short; just 1 second maximum, we retry until no error happens. If an error does occur, we inform the user. * Use web page address when making request to reload proxy (air-verse#625) * Use web page address when making request to reload proxy Signed-off-by: Alexandra Fishova <yopoyka@yopoyka.com> * Create event source with just a path because browser can handle address on its own. Signed-off-by: Alexandra Fishova <yopoyka@yopoyka.com> --------- Signed-off-by: Alexandra Fishova <yopoyka@yopoyka.com> * fix the stop_on_error is false configuration does not work (air-verse#555) * fix color output (air-verse#551) * Set the Via header in proxy requests to origin and in client responses (air-verse#629) * Set the Via header in proxy requests to origin and in client responses * Remove pseudonym and use host only * feat: Make include_file overrule include_ext, fixes: air-verse#350, base_on: air-verse#358 (air-verse#416) * feat: Make include_file overrule include_ext * feat: Make include_file overrule include_ext unittest * fix: broken code (air-verse#652) * feat: silent flag in .air.toml, suppressing all air prints (air-verse#641) * feat: silent flag in .air.toml, suppressing all air prints useful if the app being watched has structured outputs that are being piped into subsequent program/s. * update: add silent to air_example.toml * FIX: Support working directories containing whitespace (air-verse#646) * encapsulate paths with quotes to escape spaces * encapsulate paths with quotes to escape spaces * preprocess error in test * Revert "FIX: Support working directories containing whitespace (air-verse#646)" (air-verse#665) This reverts commit df13da5. * refactor: remove unnecessary var copy in for (air-verse#682) * docs: fix badge link in README-zh_cn.md (air-verse#681) * refactor: simplify test asserts; enable testifylint (air-verse#680) * Update unclear .profile changes in README.md (air-verse#684) * Fix: typo in air_example.toml (air-verse#706) * Implement kill delay on Windows (air-verse#552) * fix color output * Implement kill delay on Windows * Revert the change on master * Remove extra newline * Handle absolute paths in config (air-verse#318) * remove a data race by compiling the exclude regexes in the preprocess phase (air-verse#677) the regex compilation was done lazily on first access but did not properly synchronize for being accessed by multiple watcher goroutines between the option of adding a mutex for something that (should) only ever happen once and removing the potential for a race, this seems like the better choice * catch and report start cmd failure rather than panicing (air-verse#676) * do not report the process as running if it failed to start * change the return values on error to match what the other platforms produce * chore: fix test case TestRegexes * air -h will be document of air * Update README for air help command * fix: default config override (air-verse#719) * Avoid duplicating cors header. (air-verse#727) * fix: typos (air-verse#728) * wait for killfunc completion when shutting down current app (air-verse#670) * wait for killfunc completion when shutting down current app --------- Co-authored-by: jingdi.zhu <jingdi.zhu@bytedance.com> * Feature: Show build errors when using proxy (air-verse#725) * proxy: stream reload and error messages * proxy: Console log on build failure * proxy: show build errors in a modal --------- Co-authored-by: xiantang <zhujingdi1998@gmail.com> * Add exiter to test os.Exit case (air-verse#729) authored-by: jingdi.zhu <jingdi.zhu@bytedance.com> * Fix: using powershell instead of cmd /C (air-verse#708) --------- Signed-off-by: Alexandra Fishova <yopoyka@yopoyka.com> Co-authored-by: Rick Yu <m@c6k.app> Co-authored-by: Greg Dietsche <greg@gregd.org> Co-authored-by: Alexandra Fishova <yopoyka@yopoyka.com> Co-authored-by: dengdajun <78243198+pyjcode@users.noreply.github.com> Co-authored-by: 8LWXpg <105704427+8LWXpg@users.noreply.github.com> Co-authored-by: dedalusj <dedalusj@gmail.com> Co-authored-by: zhb127 <1224680008@qq.com> Co-authored-by: ~ jesse ~ <113159758+jesses-code-adventures@users.noreply.github.com> Co-authored-by: osteensco <86266589+osteensco@users.noreply.github.com> Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com> Co-authored-by: Gourav Kolhatkar <gstar1525@gmail.com> Co-authored-by: Olivia Bahr <ob.bahr@gmail.com> Co-authored-by: ZipFile <lin.aaa.lin@gmail.com> Co-authored-by: Isak Styf <isak@styfsoftware.se> Co-authored-by: xiantang <zhujingdi1998@gmail.com> Co-authored-by: Nemanja Milićević <the.nemanja.milicevic@gmail.com> Co-authored-by: Brandon Bloom <brandon.d.bloom@gmail.com> Co-authored-by: Nathan Baulch <nathan.baulch@gmail.com> Co-authored-by: jingdi.zhu <jingdi.zhu@bytedance.com> Co-authored-by: Polo123456789 <57022222+Polo123456789@users.noreply.github.com> Co-authored-by: Po <73031052+n1vk@users.noreply.github.com>
1 parent 43c9fc2 commit 786dedc

32 files changed

Lines changed: 946 additions & 364 deletions

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
uses: actions/checkout@v4
1818
- name: Setup Go
1919
id: go
20-
uses: actions/setup-go@v4
20+
uses: actions/setup-go@v5
2121
with:
22-
go-version-file: 'go.mod'
22+
go-version: ^1.23
2323
- name: Install golangci-lint
2424
uses: golangci/golangci-lint-action@v6
2525
with:
26-
version: latest
26+
version: v1.61
2727
- name: Install dependency
2828
run: if [ $(uname) == "Darwin" ]; then brew install gnu-sed ;fi
2929
- name: Build

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
- name: Check out code
1515
uses: actions/checkout@v4
1616
- name: Setup Go
17-
uses: actions/setup-go@v4
17+
uses: actions/setup-go@v5
1818
with:
19-
go-version-file: 'go.mod'
19+
go-version: ^1.23
2020

2121
- name: Set GOVERSION
2222
run: echo "GOVERSION=$(go version | sed -r 's/go version go(.*)\ .*/\1/')" >> $GITHUB_ENV

.github/workflows/smoke_test_reuse_job.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
uses: actions/checkout@v4
1717
- name: Setup Go
1818
id: go
19-
uses: actions/setup-go@v4
19+
uses: actions/setup-go@v5
2020
with:
21-
go-version-file: 'go.mod'
21+
go-version: ^1.23
2222
- name: Install
2323
run: make install
2424
- name: Check rebuild

.github/workflows/smoke_test_reuse_job_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
id: go
1919
uses: actions/setup-go@v4
2020
with:
21-
go-version-file: 'go.mod'
21+
go-version: ^1.23
2222
- name: Setup Python
2323
uses: actions/setup-python@v5
2424
with:

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ run:
44
linters:
55
disable-all: true
66
enable:
7+
- copyloopvar # detects places where loop variables are copied
78
- errcheck # Errcheck is a program for checking for unchecked errors in go programs.
89
- gci # Gci controls Go package import order and makes it always deterministic
910
- goimports # checks that goimports was run
@@ -12,5 +13,6 @@ linters:
1213
- revive # configurable linter for Go. Drop-in replacement of golint
1314
- staticcheck # go vet on steroids
1415
- stylecheck # static analysis, finds bugs and performance issues, offers simplifications, and enforces style rules
16+
- testifylint # checks usage of github.com/stretchr/testify
1517
- unconvert # Remove unnecessary type conversions
1618
- unused # Checks Go code for unused constants, variables, functions and types

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ LABEL maintainer="Rick Yu <cosmtrek@gmail.com>"
55
ENV GOPATH /go
66
ENV GO111MODULE on
77

8-
COPY . /go/src/github.com/cosmtrek/air
9-
WORKDIR /go/src/github.com/cosmtrek/air
8+
COPY . /go/src/github.com/air-verse/air
9+
WORKDIR /go/src/github.com/air-verse/air
1010

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

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LDFLAGS += -X "main.airVersion=$(AIRVER)"
44
LDFLAGS += -X "main.goVersion=$(shell go version | sed -r 's/go version go(.*)\ .*/\1/')"
55

66
GO := GO111MODULE=on CGO_ENABLED=0 go
7-
GOLANGCI_LINT_VERSION = v1.60.3
7+
GOLANGCI_LINT_VERSION = v1.61.0
88

99
.PHONY: init
1010
init: install-golangci-lint

README-zh_cn.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 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)
1+
# 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)
22

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

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

1717
## 特色
1818

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

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

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

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

45-
使用 go 1.22 或更高版本:
45+
使用 go 1.23 或更高版本:
4646

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

63-
6463
### 使用 [goblin.run](https://goblin.run)
6564

6665
```shell
@@ -122,6 +121,7 @@ AIR_PORT=8080 air -c "config.toml"
122121
```
123122

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

127127
## 使用方法
@@ -205,7 +205,7 @@ services:
205205

206206
```Dockerfile
207207
# 选择你想要的版本,>= 1.16
208-
FROM golang:1.22-alpine
208+
FROM golang:1.23-alpine
209209
210210
WORKDIR /app
211211
@@ -259,12 +259,11 @@ export PATH=$PATH:$(go env GOPATH)/bin <---- 请确认这行在您的配置信
259259

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

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

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

269268
```toml
270269
[proxy]

README-zh_tw.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# :cloud: Air - Live reload for Go apps
22

3-
[![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)
3+
[![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)
44

55
![air](docs/air.png)
66

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

1717
## 功能列表
1818

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

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

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

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

45-
需要使用 go 1.22 或更高版本:
45+
需要使用 go 1.23 或更高版本:
4646

4747
```bash
4848
go install github.com/air-verse/air@latest

README.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# :cloud: Air - Live reload for Go apps
22

3-
[![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)
3+
[![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)
44

55
![air](docs/air.png)
66

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

2121
## Features
2222

23-
* Colorful log output
24-
* Customize build or any command
25-
* Support excluding subdirectories
26-
* Allow watching new directories after Air started
27-
* Better building process
23+
- Colorful log output
24+
- Customize build or any command
25+
- Support excluding subdirectories
26+
- Allow watching new directories after Air started
27+
- Better building process
2828

2929
### Overwrite specify configuration from arguments
3030

3131
Support air config fields as arguments:
3232

33+
You can view the available command-line arguments by running the following commands:
34+
35+
```
36+
air -h
37+
```
38+
or
39+
```
40+
air --help
41+
```
42+
3343
If you want to config build command and run command, you can use like the following command without the config file:
3444

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

4757
### Via `go install` (Recommended)
4858

49-
With go 1.22 or higher:
59+
With go 1.23 or higher:
5060

5161
```bash
5262
go install github.com/air-verse/air@latest
@@ -209,7 +219,7 @@ services:
209219

210220
```Dockerfile
211221
# Choose whatever you want, version >= 1.16
212-
FROM golang:1.22-alpine
222+
FROM golang:1.23-alpine
213223
214224
WORKDIR /app
215225
@@ -245,12 +255,12 @@ services:
245255
```shell
246256
export GOPATH=$HOME/xxxxx
247257
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
248-
export PATH=$PATH:$(go env GOPATH)/bin <---- Confirm this line in you profile!!!
258+
export PATH=$PATH:$(go env GOPATH)/bin #Confirm this line in your .profile and make sure to source the .profile if you add it!!!
249259
```
250260

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

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

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

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

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

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

269-
* Ensure your static files in `include_dir`, `include_ext`, or `include_file`.
270-
* Ensure your HTML has a `</body>` tag
271-
* Activate the proxy by configuring the following config:
278+
- Ensure your static files in `include_dir`, `include_ext`, or `include_file`.
279+
- Ensure your HTML has a `</body>` tag
280+
- Activate the proxy by configuring the following config:
272281

273282
```toml
274283
[proxy]

0 commit comments

Comments
 (0)