You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure how to properly run air in my project:
I have a root folder which contains the following folders:
cmd
api
internal
data
validator
migrations
Without air, I'd normally run my project with go run /cmd/api.
If I run air init in the root folder, I always get:
mkdir /Users/MyUser/Developer/MyProject/tmp
watching .
watching bin
watching cmd
watching cmd/api
watching cmd/tmp
watching internal
watching internal/data
watching internal/data/validator
watching migrations
!exclude tmp
building...
no Go files in /Users/MyUser/Developer/MyProject
failed to build, error: exit status 1
running...
/bin/sh: /Users/MyUser/Developer/MyProject: is a directory
Process Exit with Code: 126
However, if I run it into the /cmd/api which is where my main.go file is, it works fine EXCEPT that if I modify any file outside of /cmd/api, then air doesn't pick up those changes.
How can I properly set up and run air so that it monitors all my changes?
Thanks!
The text was updated successfully, but these errors were encountered:
You probably figured it out, but you most likely just have to configure the air.toml (in root dir) to run go build -o temp/main cmd/api/main.go instead of what's the default.
And if you have multiple go files in the directory, point it to the entire directory, not just the main.go file, i.e. go build -o ./tmp/main ./cmd/api. @cosmtrek I think this should be included in the FAQ section, under "What to do if my go files are not in the root directory?". I have spent a good amount of time trying to figure it out because I'm a total newbie. I bet there will be more people looking for that in the future. Thanks.
Hi,
I'm not sure how to properly run air in my project:
I have a root folder which contains the following folders:
Without air, I'd normally run my project with
go run /cmd/api
.If I run
air init
in the root folder, I always get:However, if I run it into the
/cmd/api
which is where mymain.go
file is, it works fine EXCEPT that if I modify any file outside of/cmd/api
, then air doesn't pick up those changes.How can I properly set up and run air so that it monitors all my changes?
Thanks!
The text was updated successfully, but these errors were encountered: