when building getting error that there is " no Go files in /home/.. " and does not detects in the subdirectory
im using Go: 1.23.4 Air: 1.61.5 OS: nixos
After updating to version 1.61.5 of air, I encountered an issue where the main.go file is not detected when it is located in a subdirectory ./cmd. However, since the update, air fails to start or build the application unless the main.go file is moved to the root directory of the project.
The only workaround I’ve found is to move the main.go file from the cmd folder to the root of the project.
and to the air.toml i have only changed : cmd = "templ generate && go build -o tmp/main ./cmd"
I'm having the same issue.
Go version go1.23.4 darwin/arm64 Air version v1.61.5, built with Go go1.23.4 Macbook Pro M1 Sonoma 14.5 (23F79)
Have you tried this command: cmd = "go build -o tmp/main -buildvcs=false ./cmd"
Have you tried this command:
cmd = "go build -o tmp/main -buildvcs=false ./cmd"
Haven't tried it.
However I solved the issue by moving my main.go file to the project's root directory. Now it's working as expected 👍
What is the connection between the problem and -buildvcs=false buildvcs its just metadata embedding.
I updated to version 1.61.5 of air and started encountering this issue then downgraded to 1.61.4, but the problem persisted. Before 1.61.1, I didn't have any problems, and I haven't tried versions 1.61.2 or 1.61.3.
I havent looked very closely into the matter. Where and when exactly the problem started but still i know that. It seems like something specific changed after 1.61.1+ .
Same on upgrading from 1.60 to 1.61.7. Though it only popped up when I tried to move my templ command to pre_cmd
@aleks20905
The default config file should be named .air.toml not air.toml
If you want to use the config file with a different name please use air -c <filename>. Similar issue https://github.com/air-verse/air/issues/712#issuecomment-2524141577
For me this occured because my .air.toml file had an error in it -- proxy_port was not an int.
launching air by itself with the config file produces a misleading error:
__ _ ___
/ /\ | | | |_)
/_/--\ |_| |_| \_ v1.62.0, built with Go go1.24.4
watching .
watching bin
watching ci
watching cmd
watching cmd/server
!exclude tmp
building...
no Go files in /app
failed to build, error: exit status 1
running...
/bin/sh: /app/tmp/main: not found
launching air -c .air.toml shows the correct error:
/app # air -c .air.toml
2025/06/19 06:46:16 (50, 16): no value can start with o
Exactly, it's defined with a different name in the configuration file.
Just change it from air.toml to .air.toml and it works!
@aleks20905 The default config file should be named
.air.tomlnotair.tomlIf you want to use the config file with a different name please use
air -c <filename>. Similar issue #712 (comment)
that was a great help for me, thanks a lot 👍
@aleks20905 The default config file should be named
.air.tomlnotair.tomlIf you want to use the config file with a different name please use
air -c <filename>. Similar issue #712 (comment)