Tuesday, April 14, 2026
Learning golang using AI
I wanted to learn golang, but decided to give a spin and learn it using AI. The best way to learn IMHO is to do actually something and the best is to solve your own problem.
My problem: I follow some blogs/sites via RSS feeds, but would love just to get daily email with new posts (if there is anything). That would drop a need to check RSS aggregator sites and I am using email anyway.
Final result:
- Code - https://github.com/daliusd/rss
- Site - https://rss.ffff.lt/
I have started with Claude Chat (Sonnet 4.6) and following prompt:
Can you make golang server that both is web server and has cron
like behaviour for running something every 24 hours and putting that
into memory that is accessible via web server
I have started with something simple as I don’t want get everything done in single prompt. Actually doing everything in single prompt usually fails.
I got working program with structs (with JSON), functions, pointers,
references, :=, mutexes, defer, callbacks and etc. A lot of known stuff for
me as programmer who has worked with C/C++ in the past. I have asked
AI around to explain some parts and IMHO I understand the code.
Then I have configured nvim to work with go LSP (gopls). That was easy.
Next I wanted to get RSS feeds and prompted (using pi and Sonnet 4.6 via GitHub Copilot):
I want to add rss retrieval every 24 hours to @main.go
Track following feeds:
https://addyosmani.com/rss.xml
https://raw.githubusercontent.com/Olshansk/rss-feeds/main/feeds/feed_anthropic_engineering.xml
https://www.reddit.com/r/neovim/top/.rss?t=week
Remove /snapshot handler.
At root / and show retrieved RSS item title with links and content from rss
Some new concepts, but nothing too fancy. My favorite was go func(...){...}().
Next decided to add email sending with following prompt (still pi):
Now add daily emails sending with new entries:
- send to dalius.dobravolskas@gmail.com
- send from SMTP:
host: smtp.gmail.com
port: 587
user: MAIL_USER (get from env variable)
pass: MAIL_PASS (get from env variable)
- send only entries by email that were not run in previous runs
I had to steer prompt because it wanted to persist seen status in file:
persist in memory
Code is still readable and understandable, but here AI made mistake: seen in-memory store was never cleaned up. This is something what might become critical if I had a lot of feeds as in-memory store might grow up and eat all the available memory. One more prompt and problem fixed (lost this one).
Next I have asked AI to add kamal deployment like this:
Create kamal project for this go program.
Host should be rss.ffff.lt
Use following env variables:
MAIL_USER=haiku.lt.qa@gmail.com
MAIL_PASS=$(pass show gmail_haiku_lt_qa_app)
See how kamal is implemented in this project for example configuration:
/path/to/my/another/project
It is absolutely nice to get working result on the first run without googling what must be done. Then followed some minor prompts to get the result.
The last prompt was slightly more nuanced (pi again):
I would like to add https://www.reddit.com/live/18hnzysb1elcs.rss but add
postprocessing to it. This feed contains html from which twitter links should
be extracted and from twitter links actual content should be extracted. grill
me
grill me in the end was written to trigger Matt Pocock’s amazing skill
grill-me. This way AI has asked
some clarifying questions that helped to make some decisions I have not
considered in the prompt (e.g. how to get tweets from twitter).
Have I learned golang? I definitely learned some concepts (e.g. go routines), but it is still way to go:
- I have skipped testing
- All the code is in single file
- I have no idea if this is the best way to write this type of program. I have asked AI how to improve this program, but nothing non-intentional (no persistence in disk) or critical (potential spamming of my mail inbox under specific conditions) was suggested.
- Potentially there are more unknown unknowns I have not considered.
Nice side effect. Similar program written in node (http server + mail sending) takes 62Mb as Docker image. This one is 12.3Mb (5 times smaller) and there are many other benefits like in-memory size (6Mb vs 27Mb) and speed. I guess I will seriously consider writing backend of next side-project in golang.
Lastly, AI makes golang developers pool much bigger for companies who use golang as the main language in their backend stack.