Executing a Workflow from Application Code

Hi,

Using the example code for a workflow in the tutorial " Executing a Workflow from Application Code", I’m using Go 1.21.1 and getting an error.

Would love a tip as to what dumb mistake I’m making.

Scott

Could you link to the exact page that contains that code?

@maxim - This is the page.

Scott

This code sample is an excerpt meant to illustrate how you can initiate Workflow Execution from code (i.e., the Go SDK). The app package referenced here is a placeholder for the one that would contain your Workflow Definition.

I do see how this might be confusing, so I’ll think of a way to clarify that.

I meant to also add that the next exercise in the course (as well as all that follow) use similar code to start the Workflow Execution. You’ll have the opportunity to see and run a complete working example this as you continue in the course. But again, I will also update the course to clarify the example you cited, and I appreciate your feedback.

I’ve re-reviewed the course up to the issue I pointed out and see what is happening now.

I think offering the code shown in the video in “Writing a Workflow Definition” in the text below the video would help.

Edit: In fact, in the “Initializing the Worker” section, this is written:

The following is an example Go program used to initialize and start a Worker that can run the Workflow Definition shown previously.

Yet, the code is only shown in the video.

I like how the videos are peppered throughout the tutorial, it breaks up the monotony. But, at the same time content only mentioned in a video and not in the text can cause the text content to end up a bit confusing.

Scott

Hi Scott,

If you click the “Video Transcript” link directly below the video, it will expand the page to show a complete transcript of everything I said in the video, as well as the code that I showed on screen.

Please let me know if that resolves the issue you reported.

Thanks,

Tom

Yeah. Sort of I guess.

I would have not have thought to click open the transcript after watching the video though. :blush:

Maybe add “in the video transcript” after “The following is an example Go program used to initialize and start a Worker that can run the Workflow Definition shown previously.”

I’m getting picky now for sure and dancing around the fact that I just wasn’t following things well.

Thanks for the support though. Also not so common. I appreciate that!

Scott

I have updated the “Initializing the Worker” page. It now says, “The following is an example Go program used to initialize and start a Worker that can run the Workflow Definition shown during the previous video (and whose code was included in the transcript for that video)” (bold text used here to emphasize the part I added).

Thank you for the feedback—I appreciate it!

1 Like

And thank you for being patient with my feedback.

Continuing on with the course now!!! :grin:

Scott

I’m learning Go too as I go. (haha, pun not intended) :stuck_out_tongue:

I’ve found out, to import the “app” sub-package, the file or files would need to be in a folder named “app” below the root folder. And to import the functions available in that sub-package, the import would need to be “main/app” (assuming the module is called “main”). Maybe changing the code to import “main/app” might also make more sense? :thinking:

Scott

@tomwheeler - Now that I have downloaded the git repo with the tutorial code, I see where I was making a mental mistake. I was thinking the workflow definition should be below the worker and not the other way around. Learned a few things about Go in this tutorial too. :grin:

Scott

1 Like