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

examples: lang: Fix env0 example #765

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

Hiexy
Copy link

@Hiexy Hiexy commented Jul 7, 2024

Change the function call from getenv to defaultenv.

examples/lang/env0.mcl Show resolved Hide resolved

print "print2" {
msg => fmt.printf("environment variable DOESNOTEXIT does not exist, defaulting to: %s", $y),
}

$z = sys.getenv("EMPTY", "456")
$z = sys.defaultenv("EMPTY", "456")

print "print3" {
msg => fmt.printf("same goes for epmty variables like EMPTY: %s", $z),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noticed a typo here too!

Change function calls to the correct
one, remove extra argument in getenv
call, and fix typo.
@Hiexy
Copy link
Author

Hiexy commented Jul 8, 2024

I updated the commit message again, and I am using this option --force-with-lease to push the amended commit messag, but I am not sure if it is the proper way to do so.

@purpleidea
Copy link
Owner

I updated the commit message again, and I am using this option --force-with-lease to push the amended commit messag, but I am not sure if it is the proper way to do so.

Indeed it is the proper way. For most patches (especially small ones) we don't need to preserve the history of our work on this change-- IOW, suppose we made some mistakes along the way of developing this patch, we don't need to record those in git master forever.

So --force pushing over a feature branch is actually the ideal scenario.

If this was a very large patch, particularly with multiple commits, it might be preferable to add new commits until the entire PR was fixed. This can in some rare instances help the submitter and reviewer keep track of what changes they've made and so on. Only at the end does the patchset typically get squashed into one or more commits.

HTH

Patch looks perfect now, will merge shortly.

PS: Bonus points to look cool (just a lesson for future you)

Sending small typo fix style patches is definitely useful, but you get more hacker style points when the same patchset also adds a test to permanently check for that kind of bug as well. It's not always possible, but when it is, it's cooler.

@purpleidea purpleidea merged commit ccb0e55 into purpleidea:master Jul 8, 2024
3 checks passed
@purpleidea
Copy link
Owner

Merged, thank you!

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.

2 participants