-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix null reference when no env vars defined in yml #25
Conversation
@Resonious please review this |
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.
Sorry for the delay. I have a quick code question!
@davidsiaw I downloaded the binary from the CI build job https://gitlab.com/degica/barcelona-cli/-/jobs/504621079 and it still seems to segfault after performing the test instructions.
Let me know if there's something I'm missing. |
@Resonious That is embarassing. I must have messed up. I made a fix. |
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.
@davidsiaw All good - it no longer segfaults, but I have one more code question.
if err != nil { | ||
return cli.NewExitError(err.Error(), 1) | ||
} | ||
heritageName = env.Name |
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.
Looks to me like we might still need this heritageName = env.Name
part.
Later in the file, it does this
api.DefaultClient.Post("/heritages/"+heritageName+"/oneoffs", bytes.NewBuffer(j))
which might not won't work right if len(envName) > 0 && len(heritageName) == 0
.
Does that sound right?
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.
Hmm that code looks awfully suspicious. You are right. I'll try and fix it in a sane way
@Resonious sorry it took me forever to get back to this. I legitimately thought that this was solved but it wasn't. I made a change to fix that issue. I will make an issue to refactor this into a more understandable thing later. |
@Resonious I have rebased the branch against master and fixed the ci, if you have time could you please have another look? I made an issue to fix this messiness in run.go #29 |
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.
No problem - just one more tiny thing, then it should be good to go
@Resonious made some fixes to this long-overdue pr. Could you have one last look? Thanks! |
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.
LGTM 👍
This PR fixes a bug introduced in #23 where if you do not define a
run_env
section in thebarcelona.yml
it would throw a null reference error.How to test
barcelona.yml
containing this:2.Run
./bcn -d run -e hello -E FOO=bar
ew3. Observe that there is no segfault error, and it outputs