Skip to content

Goal panics with main function #22

@kkoreilly

Description

@kkoreilly

Describe the bug

When running interpreted Goal (as in Cogent Content code blocks), wrapping code in a main function can result in out of range panics.

How to reproduce

Putting this code in a main function leads to a panic (runtime error: index out of range [19] with length 0):

Example code

type Data struct {
	Time   float32
	Users  float32
	Profit float32
}
plotcore.NewEditor(b).SetSlice([]Data{
    {0, 500, 1520},
    {1, 800, 860},
    {2, 1600, 930},
    {3, 1400, 682},
})

Relevant output

Platform

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions