serverlessworkflow/sdk-go

GetFirstState always returns first declared state, not the state declared in start

ilewin opened this issue · 3 comments

ilewin commented

Calling GetFirst state always returns w.States[0] the return statement in if was forgotten

Expect first state to be the one defined in "Start"

Define a workflow with arbitrary state order and define Start to any other then first in a definition state

Should be this:

func (w *Workflow) GetFirstState() State {
	if w.Start != nil {
//note the return
		return w.GetState(w.Start.StateName)
	}
	return w.States[0]
}

spolti commented

Hi @ilewin, I think it does make sense.
Thanks for reporting, we will handle it soon.

But if you want to contribute, feel free to push a fix :)

Thanks.

ilewin commented

Hey.
Yeah i'll push

@ilewin why did you close this issue? You can open the PR and we link it here! :D