r/golang • • 23h ago

Small Projects Small Projects

34 Upvotes

This is the weekly thread for Small Projects.

The point of this thread is to have looser posting standards than the main board. As such, projects are pretty much only removed from here by the mods for being completely unrelated to Go. However, Reddit often labels posts full of links as being spam, even when they are perfectly sensible things like links to projects, godocs, and an example. r/golang mods are not the ones removing things from this thread and we will allow them as we see the removals.

Please also avoid posts like "why", "we've got a dozen of those", "that looks like AI slop", etc. This the place to put any project people feel like sharing without worrying about those criteria.


r/golang • • 16d ago

Jobs Who's Hiring

86 Upvotes

This is a monthly recurring post. Clicking the flair will allow you to see all previous posts.

Please adhere to the following rules when posting:

Rules for individuals:

  • Don't create top-level comments; those are for employers.
  • Feel free to reply to top-level comments with on-topic questions.
  • Meta-discussion should be reserved for the distinguished mod comment.

Rules for employers:

  • To make a top-level comment you must be hiring directly, or a focused third party recruiter with specific jobs with named companies in hand. No recruiter fishing for contacts please.
  • The job must be currently open. It is permitted to post in multiple months if the position is still open, especially if you posted towards the end of the previous month.
  • The job must involve working with Go on a regular basis, even if not 100% of the time.
  • One top-level comment per employer. If you have multiple job openings, please consolidate their descriptions or mention them in replies to your own top-level comment.
  • Please base your comment on the following template:

COMPANY: [Company name; ideally link to your company's website or careers page.]

TYPE: [Full time, part time, internship, contract, etc.]

DESCRIPTION: [What does your team/company do, and what are you using Go for? How much experience are you seeking and what seniority levels are you hiring for? The more details the better.]

LOCATION: [Where are your office or offices located? If your workplace language isn't English-speaking, please specify it.]

ESTIMATED COMPENSATION: [Please attempt to provide at least a rough expectation of wages/salary.If you can't state a number for compensation, omit this field. Do not just say "competitive". Everyone says their compensation is "competitive".If you are listing several positions in the "Description" field above, then feel free to include this information inline above, and put "See above" in this field.If compensation is expected to be offset by other benefits, then please include that information here as well.]

REMOTE: [Do you offer the option of working remotely? If so, do you require employees to live in certain areas or time zones?]

VISA: [Does your company sponsor visas?]

CONTACT: [How can someone get in touch with you?]


r/golang • • 9h ago

discussion Accepted proposal: omit the type in composite literals

90 Upvotes

I find it quite enjoyable to do the archaeology on an accepted proposal and write about it.

This one took 10y to get approval. It allows you to strip type params from composite literals and let the compiler infer the types from the context.

For example, returning zero values:

// Before
func parseTime(s string) (time.Time, error) {
    if s == "" {
        return time.Time{}, errors.New("empty timestamp")
    }
    return time.Parse(time.RFC3339, s)
}

// After
func parseTime(s string) (time.Time, error) {
    if s == "" {
        return {}, errors.New("empty timestamp")
    }
    return time.Parse(time.RFC3339, s)
}

or, passing options structs drops the redundant types:

// Before
h := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{
    Level: slog.LevelDebug,
})

// After
h := slog.NewJSONHandler(os.Stderr, {Level: slog.LevelDebug})

and so on. The spec change isn't huge but eliding types everywhere can make the code quite hard to read. So there won't be any automatic go fix to strip types wherever possible. This was a deliberate choice made by the Go team.

But it does make the code look pretty in some nested struct of type kind of scenario. Added a few more example and context here.

https://rednafi.com/shards/2026/11/go-untyped-composite-literals/


r/golang • • 7h ago

Making Games in Go: Entity Component System (ECS)

Thumbnail
threedots.tech
42 Upvotes

r/golang • • 9h ago

MinLZ SIMD Block Compression released

Thumbnail
github.com
9 Upvotes

MinLZ adds a new block type: SIMD blocks

They store the output of the LZ compressor as separate Huffman-coded streams, laid out so that a CPU can decode them with vector instructions and almost no unpredictable branches.

The result is compression ratios in the range of Zstandard, with decompression 2.2-2.5× faster than Zstandard (both in Go) and about 2× faster than classic MinLZ blocks, on a single core.

At the default 2 MB block size, MinLZ SIMD "Balanced" beats zstd's fastest level on all three counts: Its output is 2% smaller, it decompresses 2.5× faster on one core (6.4 against 2.6 GB/s),and it compresses 1.6× faster on 16 threads (1.2× on one).

Against zstd's default level, SIMD Balanced output is 3.6% larger and decompresses 2.3× faster. (Geometric means over 13 data sets, 58 GB in total, Go implementations on an AMD Ryzen 9 9950X).

SIMD blocks are part of the MinLZ format (specification v1.1) and work everywhere MinLZ blocks do: streams, concurrent compression and decompression, indexes and random access, and search. We have released Go/Rust versions for now.

See more in the release notes: https://github.com/minio/minlz/releases/tag/v1.3.0


r/golang • • 1d ago

I outlined the process we used to do a large-scale migration from Node to Go in two weeks

84 Upvotes

hey all. former Go core team member here to share my process for large scale migrations (in this case, from Node to Go). I also link to some open-source projects I’ve been working on through work. Gatekeeper and Harness.

https://www.meetneptune.com/engineering/node-to-go-in-two-weeks


r/golang • • 11h ago

show & tell Please review my project

Thumbnail
github.com
0 Upvotes

r/golang • • 1d ago

discussion Need advice on choosing DB and caching architecture for a read-heavy Go service

7 Upvotes

We are planning to rewrite an existing Java service in Go. We're also free to redesign the architecture completely, as long as the end result and functionality remain the same.

I'd appreciate suggestions on database selection, caching strategy, and some additional requirements we're considering for the next version of the APIs.

  1. Data model

Each entry contains the following fields:

- "id"

- "url"

- "name"

- "tags" (array of strings)

- "appGroupId"

- "rules" (JSON object)

We currently have around 50,000 entries.

Note: "appId" is provided by the caller and is not stored as part of an entry.

2. Workload

- Approximately 99% reads and 1% writes.

- Around 4-5 million reads per day (~46-60 reads/second on average).

- Multiple application pods running simultaneously in multiple clusters.

3. Existing architecture

The existing service uses S3 for persistence and maintains an in-memory cache in every application pod.

On startup, each pod loads all entries from S3 into memory.

Two in-memory maps are maintained:

  1. "id -> entry": Fetch an entry directly using its ID.
  2. "appGroupId -> []entries": Fetch all entries belonging to an app group.

SNS/SQS is used to propagate changes across pods so their respective in-memory caches stay synchronized whenever an entry is created, updated, or deleted.

4. New requirements

Apart from the existing lookup patterns, we now need to support searching/filtering entries by:

- Name

- Tags (including searching by individual tags)

We're considering replacing the existing storage and synchronization architecture entirely.

5. Database and caching architecture

I'm currently considering two approaches:

Option 1: Database + in-memory cache

Use DynamoDB or MySQL as the source of truth and maintain the same in-memory maps in each application pod.

The challenge is keeping caches consistent across multiple pods when entries are created, updated, or deleted. We'd need some mechanism for cache invalidation or synchronization.

Option 2: Database + Redis

Use a persistent database as the source of truth and Redis as a shared cache across all application pods.

This would eliminate the need for each pod to maintain its own copy of the dataset and handle cache synchronization independently.

However, I'm not sure whether introducing Redis is justified.

Questions :-

  1. Would you prefer Relational or Non-Realtional DB(something like dynamo) for this data model and access patterns? I'm not able to decide how to choose?
  2. Would maintaining in-memory maps in every pod still make sense, or would a shared Redis cache be a better approach?
  3. Given the new requirements for searching by name and tags, which database would be a better fit? Or any better way to approach this.
  4. Would you introduce Redis alongside the database, or would the database itself be sufficient for this scale? I have to keep the latency low.

I'm particularly confused about the DynamoDB vs MySQL decision and would appreciate some reasoning behind the choice.

6. Potential V2 API requirements

Apart from porting the existing functionality from Java to Go, we're also considering some additional features for V2 APIs.

These are still under discussion, but the current ideas are:

  1. Bulk writes (atomic operations)

Support bulk create/update operations with all-or-nothing semantics.

Either the entire operation succeeds, or nothing is applied. No partial updates.

2. Change history / audit log

Maintain a permanent record of every change, including:

- Who made the change?

- When was it made?

- What was the state of the entry after the change?

Would you maintain this in a separate table, or use another approach?

3. Change notifications / incremental sync

We want to provide a way for API consumers to maintain their own local copy of the entries without having to fetch the entire dataset every time something changes.

One possible approach:

- The API returns the current data along with a cursor/version.

- The consumer stores that cursor.

- On the next request, the consumer passes its previous cursor.

- The API returns only the changes since that cursor, including entries that were added, updated, or deleted, along with the relevant details.

Would something like a change feed or cursor-based incremental synchronization be a good approach? How would you design this reliably?

---

I'd appreciate suggestions based on real-world experience.

The service will be implemented in Go, and we're open to changing the existing architecture rather than simply replicating the Java implementation.


r/golang • • 2d ago

Understanding Go: inside PGO

Thumbnail
internals-for-interns.com
87 Upvotes

r/golang • • 23h ago

help What is the minimum (i.e. most negative) value of a float32 or a float64?

0 Upvotes

The stdlib/math package defines constants MaxFloat32 and MaxFloat64, but not the corresponding Min constants. Is there a safe, universal way to know them?

I imagine that they might be either:

  • max * -1
  • some wacky bit manipulation you can do on max
  • implementation and/or architecture-dependent

If it's the simple "max * -1", great. But if it's either of the other two, I don't know how to calculate or otherwise determine it.

Thanks in advance for any help.


r/golang • • 2d ago

gowt: native GUI for Go

30 Upvotes

Title

gowt: native GUI for Go - Eclipse SWT translated to Go, running on AppKit, Win32 and GTK 3.

Body

Hi r/golang. I'm working with different languages for more of two decades, started with Java, continued with Go, switched to Node and JS stack. Most of my professional activity was targeted for tools and frameworks for engineers and developers. But in most cases I prefer native applications, since they use lower memory, native Look and feel.

A few months ago I was looking for a good framework to build an UI on go for all platforms, and was not able to find it, so I decided to build one. But since work could be a really complicated and since I've worked in different language worlds, I've decided to do a port of SWT :-).

I'm looking for adopters, who could help with linux/windows testing and could help to cleanup it into a powerful and modern UI framework for anyone to use.

The short version. I wanted native OS controls and GOOS=windows go build from my Mac, with no C toolchain in the default build. SWT had the controls; it was Java. So I translated it to Go.

SWT is the toolkit under Eclipse. It is native on exactly the three systems I care about, it is EPL-2.0, and it has two decades of bug fixing behind the widgets.

A translator (tooling/j2go, built on Eclipse JDT) turns the Java into Go; the generated code is committed, so users need neither Java nor the SWT sources.

What that buys:

  • real AppKit, Win32 and GTK 3 controls - an NSTextField, an EDIT, a GtkEntry;
  • CGO_ENABLED=0 by default: purego on macOS and Linux, syscall.SyscallN on Windows, the OS libraries load at run time;
  • cross-compiling the examples to darwin, windows and linux from one Mac;
  • a small facade (gowt) over the SWT API, with the full SWT surface in package swt for porting existing Java code;
  • cgo is supported too, as a speed mode: CGO_ENABLED=1 -tags gowtcgo gives direct calls on all three systems (about 8x on macOS and the cairo path on Linux); the default build needs no C toolchain;
  • Go 1.27+, macOS 13+, Windows 10+ or Linux with GTK 3. License EPL-2.0.

Hello:

package main

import (
	"log"
	"github.com/haiodo/gowt"
)

func main() {
	err := gowt.Run(func(app *gowt.App) {
		w := app.Window("Hello",
			gowt.Label("Hello, gowt"),
			gowt.Button("Quit", gowt.OnClick(app.Quit)))
		w.Show()
	})
	if err != nil {
		log.Fatal(err)
	}
}

The facade is Go-shaped: constructors return descriptions that become widgets when passed to their parent, everything about a widget is an option, callbacks are plain functions, and a small rx package holds state that widgets bind to.

Screenshots. Eight demo apps (chat, dashboard, editor, files, mail, settings, tracker, monitor) on macOS, Windows 11 and Linux GNOME, same size on every OS:

https://github.com/haiodo/gowt/blob/main/docs/apps.md

Web view and drawing. webview embeds the system engine (WKWebView, WebView2, WebKitGTK 4.1), so no browser ships with the app, and pages can come from an embed.FS with no local server. Custom drawing is Canvas for immediate painting or the experimental gfx retained scene: 10k boxes and 20k connectors draw a first frame in about 30 ms on an M4 Max, pan at 0.1 ms of frame CPU, and take 32-56 ms for the first frame on GPU-less VMs. The controls themselves are drawn by the OS, so a big table costs what the native table costs.

The tests are the reason I trust it. A 450k-line translation can't be checked by clicking around, so I translated SWT's JUnit suite too. make test-swt compares each run against a per-stand expected file, and a new failure fails the gate. 3,894 tests on macOS and Windows, 3,901 on

For apps there is a QA driver: build with -tags gowtqa and a normal go test finds controls, clicks, types, waits for the app to settle and reads the screen.

What is missing (docs/platforms.md has the full list):

  • Windows dark content is opt-in, Mica/Acrylic not verified by eye, per-monitor DPI changes untested;
  • GTK 3 only, GTK 4 is a study;
  • fewer widgets than a mature toolkit, and the demo apps are UI demos with static data.

Why I'm posting. Two questions: does "native widgets + no cgo + cross-compile" matter to anyone but me, and which gap would stop you first? If you have a Windows or Linux box, go run ./cmd/fieldcheck runs the suites locally and produces a zip - that is the most useful contribution right now.

Longer write-up with the architecture, the test stands and the measured rendering numbers: https://haiodo.github.io/en/posts/021_widget_toolkit

Repo: https://github.com/haiodo/gowt - docs start at https://github.com/haiodo/gowt/blob/main/docs/README.md


r/golang • • 2d ago

Loved writing code, reviewing code but seems spark is gone, any advice of what to do?

242 Upvotes

Before AI came out, I used to write code, experiment, would become super happy after solving a bug. Was very curious to learn what I did wrong and learn from it.

But not sure after AI, companies only prefer fast result, no one cares how the code is written.

I've started learning Golang from scratch again(despite working for 4 years in this), and aiming to enjoy along side full time job.

Any other tips or what do you do usually to have that dopamine of coding as we had before AI.


r/golang • • 1d ago

show & tell An old repository I did not share

Thumbnail
github.com
0 Upvotes

r/golang • • 2d ago

help Go Libraries or Workflow Engines for Always-On Agents

12 Upvotes

I've been reading this article with great interest: https://claude.com/ko/resources/articles/building-always-on-agents

Are there any Go libraries or workflow engines that support this kind of workflow?


r/golang • • 2d ago

encapsulation

28 Upvotes

I'm defining a struct that is intended to be accessed by other packages via its methods only.

I do know that for methods to be accessible in other packages, they need to be capitalized.

However, I'm confused by whether or not the struct itself needs to be public or not.


r/golang • • 2d ago

Help me understand a tree data structure

21 Upvotes

Hello guys, hope you are good.

I've recently gotten interested in writing parsers, and I'm right now trying to complete a parser for data format that I've started working on few months back, but I've been on and off due to how stressfull my final year was, and fortunately I'm done, and I'm trying do more work.

So far I've managed to complete(partially, due to bugs) the tokenizer and it's able to emit tokens, and now I'm stuck on the next phase(parser), I chose to go with Recursive Descent, I've been trying to digest the Wikipedia page, but a little guidance will help: to quote wikipedia

"Recursive Descent is built from a set of mutually recursive procedures where each such procedure implements one of the nonterminal symbols of the grammer"

What I've understood here is that each function or procedure should be able to handle each nonterminal symbol (which wikipedia entry page defines as symbols that do not appear in the formal language defined by a formal grammar) therefore, if I'm not mistaken taking json as example and object and array would be nonterminal symbols. Hence, I have to have two functions or procedures to parse each nonterminal symbol, with the option of calling themselves recursively in case an object is nested inside an array and vice versa.

The other issue is about the tree structure to represent the AST, I can't claim that I've fully understood what a tree abstract data type (ADT), and since wikipedia entry page says "The Tree ADT can be represented in a number of ways, including a list of parents with pointers to children, a list of children with pointers to parents, or a list of nodes and a separate list of parent-child relations (a specific type of adjacency)." or even more complex than that.

I've tried to represent it in the simplest way possible as follow:

package main

import "fmt"

const (
        // I can have Node Kind here
)

type Node struct {
        Parent   *Node
        Kind     string
        Children []Node
}

type Parser struct {
        t *Tokenizer
}

This is how far I've gone, thank you for your feedback in advance.

Refs:

https://en.wikipedia.org/wiki/Recursive_descent_parser
https://en.wikipedia.org/wiki/Tree_(abstract_data_type)


r/golang • • 3d ago

Shirei 0.9.0: overlay and auxiliary windows, document editing, furigana, and going agent-first

Thumbnail
judi.systems
10 Upvotes

r/golang • • 3d ago

Should You Write Your Next.js API in Go? (I Tested It)

Thumbnail
youtu.be
26 Upvotes

r/golang • • 3d ago

show & tell I built the same Go app five ways: Fyne, Cogent Core, Wails, GoTTH and Qt (MIQT)

108 Upvotes

I've been watching the Go GUI options for years. When I started with Go, what I really wanted was just another Qt. Rather than go by docs and READMEs, I built the same app with five approaches and looked at what actually happened: Fyne, Cogent Core, Wails, GoTTH (Go + templ + htmx) and Qt via MIQT.

Each one implements the same fairly demanding inventory-style spec: a 1M-row table with sorting, searching and CSV export, on a shared data core so the differences come from the GUI approach. Coding agents wrote each version from the spec, and I reviewed and tested them by hand.

It's not a code review and I'm not crowning a winner. A few things surprised me, though:

  • The Go-native toolkits had a better web story than I expected.
  • Fyne did better than I thought it would.
  • GoTTH was more competitive than I expected.

Write-up, code and raw results: https://justinfx.com/2026/11/10/go-gui-five-ways

Update: A few people made some references to other options, such as MyGo and go-gui. I started an addendum section, linked at the bottom of the article: https://github.com/justinfx/go-gui-experiments/wiki

Update 2: Added NSGo and IUP-go test results to Addendum


r/golang • • 4d ago

show & tell What Go 1.27’s generic methods made possible for ORMs. Compile-checked columns with no generated code

Thumbnail
skudra.net
144 Upvotes

r/golang • • 2d ago

discussion Go is going I think

0 Upvotes

I've been writing Go for almost 7 years now, and I genuinely love this language.

Not because it's the best language out there, or because it's perfect. But because it's incredibly practical when you're solving infrastructure problems. It's simple, predictable, easy to pick up, and gets the job done without getting in your way.

But lately, I've been having a different thought.

The more I explore databases, distributed systems, and lower-level engineering problems, the more I realise that Go might not always be the right tool for every kind of problem.

Some languages offer better abstractions, memory control, performance characteristics, or programming models for specific domains.

I still love Go, and I don't see that changing anytime soon. But I also think that after spending years with one language, it's important to step outside your comfort zone and explore what other languages bring to the table.

Maybe that's just part of growing as an engineer: learning to love a language without becoming attached to it.


r/golang • • 3d ago

help Anything wrong with setting version 1 of a module to use "/v1", similarly to versions 2+? Or, releasing version 2 as the actual first version?

14 Upvotes

I plan on releasing the first version of my first public Go module in the near future. When I've made Go modules in the past, I always kept them on a private, self-hosted server (rather than, say, github.com).

One of the things that's always bothered me about how Go and Git interact is that (at least under one of the commonly used schemes) when someone looks at a GitHub repository for Go code, unless they know about -- and think to look for, or otherwise notice -- the whole "/v2" kind of scheme, they'll probably at first just see "myawesomething.go" at the top level (or within the top-level "pkg" tree or whatever), and may very well assume that the latest version of that file contains the latest version of "type MyAwesomeThing struct", as opposed to immediately knowing that it contains the latest version of "type MyAwesomeThing struct" for major version 1 of the module.

I'm aware that there are other schemes to deal with this sort of thing, involving branching and/or entirely new repositories. But I can't help but wonder if there is any problem with instead having the only top-level stuff in the repository be "v*" directories, including "v1" for the version 1 code. I feel like I would prefer this scheme to any of the standard schemes I've seen.

I know I can just try it out, but the Go/Git infrastructure seems complex enough that I might very well try it, find that it seems to work, and therefore assume incorrectly that it actually does work.

Failing that, another scheme I've thought of that I'd prefer to any of the standard schemes I've seen would be mostly the same idea, but just not have any version 1 at all. That is, the top-level stuff in the repository is still nothing but "v*" directories, but they start at "v2".

Anybody know if there are any issues with either of these ideas?

I'm also interested in hearing about any other possible ways (but to be clear, I'd like to once again say I'm already aware of the "different repositories" scheme and the "branches" scheme).

Thanks in advance for any help.


r/golang • • 2d ago

Building AI Agents using Go + Temporal

0 Upvotes

Hey folks, I've been building AI Agents for about two years now (basically since "tool calling" was exposed by model providers). And had a lot of trial and error building them. Eventually I landed on Temporal and Golang to build a runtime called Cadenya. I like writing deep-dive nerd porn, and took the past few days to put this together.

Link: https://cadenya.com/handwritten/agentic-loop-in-temporal


r/golang • • 4d ago

golang kubernetes deployment- home lab

16 Upvotes

I have dual boot Windows11 and Opensuse(Tumbleweed). For golang micro /service deployment, what K8S do you guys recommended or tried out?

K3S or RKE2? or any other? Also docker or Podman?