#Air "no go files in ..."

16 messages · Page 1 of 1 (latest)

plucky fiber
#

I must be doing something stupid because I can't get air to build my files correctly.
in .air.toml I have:

  cmd = "go build -o ./tmp/main ./cmd/*.go"

but when I launch air, it outputs:

no Go files in /home/ktz/git/poe-inv
failed to build, error: exit status 1

/home/ktz/git/poe-inv being my project root.
My go files atm are cmd/main.go and cmd/utils.go

#

it does run the built binary in /tmp/ though, if it finds one:

  bin = "./tmp/main"
#

air -build.cmd="go build -o tmp/main cmd/main.go"

#

doing this manually works...

#

I just added "templ" to the list of extensions to watch

#
[build]
  args_bin = []
  bin = "./tmp/main"
  cmd = "go build -o tmp/main cmd/main.go"
  delay = 1000
  exclude_dir = ["assets", "tmp", "vendor", "testdata", "static"]
  exclude_file = []
  exclude_regex = ["_test.go"]
  exclude_unchanged = false
  follow_symlink = false
  full_bin = ""
  include_dir = ["view"]
  include_ext = ["go", "tpl", "tmpl", "html", "templ"]
  include_file = []
  kill_delay = "10s"
  log = "build-errors.log"
  poll = false
  poll_interval = 0
  rerun = false
  rerun_delay = 500
  send_interrupt = false
  stop_on_error = false
#

this is my build section

#

I tried this too:

[build]
  args_bin = []
  bin = "./tmp/main"
  cmd = "go build -o ./tmp/main ./cmd/main.go"
  delay = 1000
  exclude_dir = ["assets", "tmp", "vendor", "testdata", "static"]
  exclude_file = []
  exclude_regex = ["_test.go"]
  exclude_unchanged = false
  follow_symlink = false
  full_bin = ""
  include_dir = ["view"]
  include_ext = ["go", "tpl", "tmpl", "html", "templ"]
  include_file = []
  kill_delay = "10s"
  log = "build-errors.log"
  poll = false
  poll_interval = 0
  rerun = false
  rerun_delay = 500
  send_interrupt = false
  stop_on_error = false
quartz forge
#

Do not add argument *.go, just do ./cmd

#

*.go only parse and be replaced in shell environment

plucky fiber
#

that helps, thanks

#

however it doesn't seem to solve the original problem

#

it feels like air doesn't take into account my [build].cmd

#

I need to pass it manually with air -build.cmd="go build -o tmp/main cmd/"

#

I just realized that [build].bin is also not taken in correctly. Maybe it's not using my conf at all