Example code, Codewars katas and a compiler for the Monkey programming language.
Ben Davis has a nice video walk through on how to install Go and set up the path variable
"Learn X in Y minutes" has a good introduction to Go
go run main.go
go mod init name-of-project
go build
./name-of-project
go build && ./name-of-project
The FreeCodeCamp YouTube channel has a beginners course to get you started.
Large Language Models (LLMs) are only effective for me because I don't trust their output.
I always test the code that they generate!
However, given that Go is a mature language, backed by Google, there is a suprising amount of training data available.
I have had good results with prompts using the following template
Write a [name] function in Golang that takes
[name the parameters and their types] and returns
a [type] such that [describe what the function does].
Then show me the code.
Another strategy is to provide the LLM with a list of function signatures for a particular utility or feature and ask the LLM to implement the function bodies, one by one, asking for your feedback at each step.
I asked the LLM to generate a TUI (Text User Interface) todo app using the gorm ORM and sqlite.
In this lengthy conversation with Chat-GPT I was given the basic functionality I needed.
Although feeding errors back to Chat-GPT4 can yield good results, sometimes a conversation will drag on so long that the LLM "forgets" what you are talking about and the chatbots answers rapidly become useless.
This is because of a fundamental limit built into the LLM. Namely the maximum size of its context window. The size of the context grows as the conversation progresses.
To avoid running up against this limit when you are working on a code generation task, simply delete the chat you are using, start a new one, attach the source code that needs fixing to the chat (the "Advanced Data Analytics" plugin should be enabled), tell the chatbot that there are syntax errors or unexpected behaviour and ask for its help.
This process can be repeated as often as necessary!