Skip to content

Detect main.go in subdir when running air init with defaults#736

Open
nesselchen wants to merge 1 commit intoair-verse:masterfrom
nesselchen:cfg-main-in-subdir
Open

Detect main.go in subdir when running air init with defaults#736
nesselchen wants to merge 1 commit intoair-verse:masterfrom
nesselchen:cfg-main-in-subdir

Conversation

@nesselchen
Copy link
Copy Markdown

Motivation

I ran air init without args in a project that already had a main in a cmd subdirectory. Running air init always uses the current directory as default arg for the TOML file's cmd block. I figured it would be cool if air init detected any pre-existing main.go files as I usually don't initialize air before building the base structure of the project.
Also, the error when running air on a directory is fairly confusing (bin/bash: permission denied) so it would also alleviate the potential for that error occurring in the first place.

Changes

This PR still passes the current dir to go build if ./main.go exists or no main.go exists. Otherwise it inserts the first main.go found when pre-order traversing the file system.

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

Successfully merging this pull request may close these issues.

1 participant