air icon indicating copy to clipboard operation
air copied to clipboard

tmp directory is always created in project root

Open PhilThurston opened this issue 7 months ago • 0 comments

Right now even if you specify that the tmp directory is different from the project root air will still make a tmp directory in the current root. For example. If your air.toml is like this:

root = "."
testdata_dir = "testdata"
tmp_dir = "/tmp/air"

[build]
  args_bin = []
  bin = "/tmp/air/main"
  cmd = "go build --buildvcs=false -o /tmp/air/main ."
  delay = 1000
...

and you run with the docker container like so:

docker run -it \
    -w "/app" \
    -e "air_wd=/app" \
    -v "$(PWD)":/app \
    -v /tmp/air/go:/go/pkg/mod \
    -p 3000:3000 \
    cosmtrek/air -c .air.toml

the result is that not only will it make a tmp directory in your project root owned by the docker user (usually root) and it will also error out. It looks like this solution is partially resolved with this pull request #318 but that doesn't resolve the fact that air doesn't respect the config and still makes a temp directory where it wants to regardless of the settings listed.

PhilThurston avatar Nov 23 '23 05:11 PhilThurston