Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

".air.toml" fails to parse and air proceeds silently #516

Open
matheusgomes28 opened this issue Jan 22, 2024 · 0 comments
Open

".air.toml" fails to parse and air proceeds silently #516

matheusgomes28 opened this issue Jan 22, 2024 · 0 comments

Comments

@matheusgomes28
Copy link

When a user provides an invalid toml config that fails to be parsed, air will silently continue with default settings. Very confusing if you are debugging what's going on.

Example of wrong .air.toml config:

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

[build]
  cmd = "make build-debug"
  args_bin = []
  bin = "./tmp/urchin-debug"
  full_bin = "dlv exec ./tmp/urchin-debug --listen=127.0.0.1:2345 --headless=true --api-version=2 --accept-multiclient --continue --log -- "
  delay = 1000
  exclude_dir = ["assets", "tmp", "vendor", "testdata"]
  exclude_file = []
  exclude_regex = ["_test.go"]
  exclude_unchanged = false
  follow_symlink = false
  include_dir = []
  include_ext = ["go", "tpl", "tmpl", "html"]
  include_file = []
  kill_delay = "0s"
  log = "build-errors.log"
  poll = false
  poll_interval = 0
  post_cmd = []
  full_bin = ""
  pre_cmd = []
  rerun = false
  rerun_delay = 500
  send_interrupt = false
  stop_on_error = false

[color]
  app = ""
  build = "yellow"
  main = "magenta"
  runner = "green"
  watcher = "cyan"

[log]
  main_only = false
  time = false

[misc]
  clean_on_exit = false

[screen]
  clear_on_rebuild = false
  keep_scroll = true

Note the multiple defined full_bin. For clarity, I was wondering why the following Makefile wasn't running properly:

BINARY_NAME=urchin
URCHIN_BIN_PATH=./cmd/$(BINARY_NAME)

clean:
	rm -f ./bin/*

build-debug: clean
	echo "Hello There"
	CGO_ENABLED=0 go build -gcflags=all="-N -l" -o ./tmp/$(BINARY_NAME)-debug $(URCHIN_BIN_PATH)

Output from air with the above setup (simply typing air from dir with the .air.toml file):

$ air
 __    _   ___  
 / /\  | | | |_) 
/_/--\ |_| |_| \_ v1.49.0, built with Go go1.21.6
watching .

watching app
watching cmd
watching cmd/urchin
watching common
watching database
watching migrations
watching static
watching templates
watching templates/contact
watching templates/index
watching templates/post
watching templates/services
!exclude tmp
building...

no Go files in /home/matheus/development/urchin

failed to build, error: exit status 1

Output when running air -c .air.toml - a correct output:

$ air -c .air.toml  __    _   ___  
 / /\  | | | |_) 
/_/--\ |_| |_| \_ v1.49.0, built with Go go1.21.6

2024/01/22 21:59:42 (24, 3): The following key was defined twice: build.full_bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant