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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nesselchen
Copy link

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