-
Notifications
You must be signed in to change notification settings - Fork 315
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
bazelisk.go: add simple .bazeliskrc file support #127
Conversation
Replace `os.Getenv` with `getEnvOrConfig`, which falls back to parsing key=value pairs from a `.bazeliskrc` file in the workspace root. Environment variables take precedence. Aims to solve #119 as simply as possible.
fyi, @cheister |
@philwo, is there anything that the community can do to help push this one through? I think this PR has a lot of merit, and would reduce configuration burden on newcomers to bazelisk. |
@joeljeske Sorry, I've been super busy with finishing non-Bazelisk things that have to be done until end of this quarter - I'll get back to the issues and PRs here as soon as possible. Really looking forward to review / merge this and address any other open things. |
continue | ||
} | ||
key := strings.TrimSpace(parts[0]) | ||
if strings.HasPrefix(key, "#") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly more efficient if this check is the first line inside the loop
} | ||
|
||
// Parse .bazeliskrc in the workspace root, once, if it can be found. | ||
fileConfigOnce.Do(func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: for my taste a bit too long for an anonymous function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feature! Please update the readme file and add a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will merge as soon as comments are addressed. Overall LGTM!
I talked with @fweikert, I'll just merge this now and we can polish later. 😊 |
Replace
os.Getenv
withgetEnvOrConfig
, which falls back to parsingkey=value pairs from a
.bazeliskrc
file in the workspaceroot. Environment variables take precedence.
Aims to solve #119 as simply as possible.