Feng's Notes Isn't coding fun?
Posts with the tag Go:

Go Embed Vite

Go has a great feature that it can be packaged into a single binary which is easy for distribution. However when it comes to web application it’s a bit tricky becuase 1. you need to bind frontend assets into the binary and 2. you need to deal with the routing if you are building a single page application(SPA). In this post I will walk you through how to embed a vite built react app into a go binary and how to handle the routing using gin framework.

Wails Review

I was looking for an all-in-one solution for building apps with golang. Then I found Wails, it is claimed as a cross-platform framework for building apps with Go as backend. On the frontendside, it allows you to use modern web technologies such as Vue.js, React.js, and Angular.js. It sounds fancinating, so I decided to give it a try and dig a little bit on how it works.

CodeDeepDive -- Loki (1)

This is the start a series of posts about the notes I made when I read the source code of popular open source projects. I myself learned a lot from digging into the code of open source projects. I hope it can help you too. I will start with Loki, a log aggregation system inspired by Prometheus. Overview grafana/loki consists two components: Loki: the log aggregation system Promtail: the agent to collect logs and send to Loki in a nutshell, loki and promtail is a service-client arhitecture.

How to build a modern web app with Go and React

Go is a fancinating language for building backend service, while React is a modern framework for building frontend web app. I would like to share my experience on how you can put this two together to build a full stack web app. The structure The chance is you probably can find a template on github and develop your app based on that. But I recommend you pause for a second and think about the structure of the codebase.

Learn How to Build Go Applications From Grafana

Grafana has developed really fast in the past few years. It has been the de facto standard for observability. I have been using grafana and loki for a while and I am really impressed by its performance and the quality of the code. Grafana builds most its backend components in Go. Meanwhile I am also using Go to build stuff. So it seems a good idea to learn some good practice from Grafana’s codebase.

Build Go Commandline App With Cobra

The framework I am using to build this blog is Hugo. Under the hood, it uses Cobra to build the command line interface. Besides Hugo, Cobra is also used by many other popular projects such as kubectl, github cli, etc. I was curious about how it works so I decided to learn by building a simple command line app with it. The app I am going to build is a regex tool that uses openAI’s API to generate a regex expression based on a list of strings or the semantic meaning of the given strings(e.

Goroutine Pool review

Goroutine is perhaps the main reason why people choose golang for their projects. It is a lightweight thread managed by the go runtime. It is also easy to use. You can simply use go keyword to start a goroutine. However, if you need to run a large number or cpu intensive goroutines, you might want to use a goroutine pool to manage them and make sure you don’t run out of memory or cpu resources.

Task queues in different languages

Task queue is used widely in software development. It is a mechanism to distribute work across threads or machines. It is also a way to coordinate workers to perform tasks. The scenario could be a web application that needs to process a large number of requests, a data pipeline that needs to process a large amount of data or a scheduled job that needs to run periodically. I have used task queues in different languages.

Rss reader in golang -- Miniflux review

Background I have been using feedly for years to read rss feeds. It is a great service however it grows more and more complicated and tries hard to sell me their premium features. I understand that they need to make money, but I decided to find a self-host solution for my simplest need: read self selected rss feeds on a clean UI. no AI recommendation, no social sharing, no fancy features.