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

🐛 c.PlanRaw can be nil #196

Merged
merged 1 commit into from
Nov 28, 2023
Merged

🐛 c.PlanRaw can be nil #196

merged 1 commit into from
Nov 28, 2023

Conversation

MadsBogeskov
Copy link
Contributor

@MadsBogeskov MadsBogeskov commented Nov 28, 2023

Hi Empowers!
I am getting a crash in Shuttle: https://github.com/lunarway/design-tokens/actions/runs/7009031830/job/19066620748?pr=17
The problem seems to be this piece of code in shuttleconfig.go:125 (Brilliantly found by reading the stacktrace)
The code crashing seems to be this:

switch c.PlanRaw {
    case false:
        // no plan
    default:
        c.Plan = c.PlanRaw.(string) // <-- this line to be specific

I assume this is a case that should be caught by the switch statement using what I assume is dark Go magic, instead of just doing a if c.PlanRaw == nil .

I am a bit unsure of what the right fix here is, besides just doing a nil check.

But this PR at least provides better logging in case this happens for someone else.

@MadsBogeskov MadsBogeskov requested a review from a team as a code owner November 28, 2023 08:29
@mahlunar
Copy link
Member

Thanks for the PR. Please fill in the description, so we know why the change was made when looking back at this in a few years.

@MadsBogeskov
Copy link
Contributor Author

@mahlunar Hope this improves it.

@kjuulh
Copy link
Contributor

kjuulh commented Nov 28, 2023

Thanks for your contribution. This fix is enough for now. And should be fixed once we get yaml.v3 merged, which handles nulls a little differently =D

@kjuulh kjuulh merged commit 24216f7 into master Nov 28, 2023
2 checks passed
@kjuulh kjuulh deleted the check_for_nil branch November 28, 2023 08:55
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.

None yet

3 participants