jub0bs's Avatar

jub0bs

@jub0bs.com

infosec enthusiast • Go dev & trainer • contributor to the Go project • minimalist • chaotic good • trying to make sense of the Web • he/him Blog: https://jub0bs.com Free Go course: https://github.com/jub0bs/go-course-beginner Free 🇵🇸! Leave 🇱🇧 alone!

2,335
Followers
269
Following
436
Posts
06.07.2023
Joined
Posts Following

Latest posts by jub0bs @jub0bs.com

Preview
GitHub - dominikh/go-tools: Staticcheck - The advanced Go linter Staticcheck - The advanced Go linter. Contribute to dominikh/go-tools development by creating an account on GitHub.

"Open-source but closed for contributions" is the sweet spot for me. I like @honnef.co's take on this approach: github.com/dominikh/go-...

10.03.2026 10:16 👍 4 🔁 0 💬 0 📌 0
Preview
proposal: spec: make bool an ordered type · Issue #78027 · golang/go Go Programming Experience Experienced Other Languages Experience Python, Haskell, JavaScript, C Related Idea Has this idea, or one like it, been proposed before? Does this affect error handling? Is...

I've just filed a proposal to make bool an ordered type (compatible with operators <, <=, >, and >=) in #golang: github.com/golang/go/is...

09.03.2026 09:50 👍 9 🔁 0 💬 0 📌 0

Fascinating! Thanks for sharing. 🙇

02.03.2026 15:14 👍 0 🔁 0 💬 1 📌 0

#golang quiz: What happens if you try to compile and run the following program?

package main

import (
"fmt"
"math"
)

func main() {
fmt.Println(int(math.NaN()))
}

a. It prints 0.
b. It prints -1.
c. It panics.
d. Compilation fails.
e. Something else.

02.03.2026 14:54 👍 0 🔁 0 💬 1 📌 0
spec: add range over int, range over func · Issue #61405 · golang/go Following discussion on #56413, I propose to add two new types that a for-range statement can range over: integers and functions. In the spec, the table that begins the section would have a few mor...

Besides, I welcomed support for ranging over ints. The gain in readability over a classic three-clause loop is real, as explained in the following comment: github.com/golang/go/is...

02.03.2026 14:46 👍 0 🔁 0 💬 1 📌 0
Preview
cmd/compile: poor escape analysis of `strings.SplitSeq` · Issue #73524 · golang/go Go version go version go1.24.2 linux/amd64 Output of go env in your module/workspace: AR='ar' CC='gcc' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_ENABLED='1' CGO_FFLAGS='-O2 -g' ...

One source of complexity surrounding iterators, IMO, is when the iterator is designed as "impure", in the sense that even if the yield function you pass it is a pure function, consuming the iterator has side effects. A subtlety that can trip even seasoned Gophers up: github.com/golang/go/is...

02.03.2026 14:41 👍 1 🔁 0 💬 0 📌 0

Ranging over a channel too only yields (at most) a single value.

02.03.2026 14:37 👍 0 🔁 0 💬 2 📌 0

As a consumer of iterators, you're largely isolated from the complexity they deploy under the hood, esp. if those iterators are designed as pure functions. Things are different if you have to implement iterators yourself but, again, not prohibitively so, IMO.

02.03.2026 09:26 👍 0 🔁 0 💬 1 📌 0

Thanks! Yeah, and the kind of forward compatibility that error types unlocks in comparison to error values is appreciable as well.

01.03.2026 16:47 👍 0 🔁 0 💬 0 📌 0

Well, generics certainly made the language more complex, but not prohibitively so, IMO. I think Go's agenda of simplicity is as strong as ever.

01.03.2026 16:46 👍 0 🔁 0 💬 1 📌 0
Why concrete error types are superior to sentinel errors TL;DR ¶ Exported concrete error types are superior to sentinel errors. They can be more performant, cannot be clobbered, and promote extensibility. Third-party function errutil.Find is a powerful alte...

A bit of a downer, this one, lads! 😅

At some stage of this episode, Kris wishes for some (official) guidance about error handling. The following take is far from official and comprehensive, but I'd love to hear your thoughts about it: jub0bs.com/posts/2025-0...

01.03.2026 14:04 👍 1 🔁 0 💬 1 📌 0

I think we all do! The proposal being accepted so early in this release cycle gives me high hopes for Go 1.27. 🤞

27.02.2026 13:39 👍 0 🔁 0 💬 0 📌 0

Since the inception of generics in Go (1.18), methods could not introduce type parameters. You had to resort to declaring package-scoped functions instead; code organisation and ergonomics typically suffered.

The proposal lifts this restriction for concrete types (though not for interface types).

26.02.2026 09:55 👍 2 🔁 0 💬 0 📌 0
Preview
spec: generic methods for Go · Issue #77273 · golang/go Proposal: Generic Methods for Go A change of view. Background For clarity, in the following we use the term concrete method (or just method when the context is clear) to describe a non-interface me...

🚀 "spec: generic methods for Go" has been accepted!

You will soon (1.27?) be able to declare (on concrete types only) methods that introduce type parameters, i.e. type parameters other than the ones (if any) that come from the method's receiver.

github.com/golang/go/is...

#golang

26.02.2026 09:32 👍 11 🔁 3 💬 3 📌 0
Preview
Go Playground - The Go Programming Language

Thanks. 😊

Not a big fan of that new Go method in general, but you're right that it helps readability in this case: go.dev/play/p/HuIoL...

25.02.2026 15:59 👍 1 🔁 0 💬 0 📌 0

(If you get a timeout on the playground, try again, or try running the program locally.)

25.02.2026 09:00 👍 0 🔁 0 💬 0 📌 0
Preview
Go Playground - The Go Programming Language

A friendly reminder that a Go program doesn't need an import of the "unsafe" package to undermine the language's type system; a synchronisation bug may be enough: go.dev/play/p/L0_Zr...

#golang

25.02.2026 08:56 👍 8 🔁 1 💬 2 📌 1

Great idea! I wasn't planning to, but now I have to explore it to live up to your expectations. 😅

25.02.2026 02:54 👍 6 🔁 0 💬 0 📌 0

For months (maybe years, even) now, I've been accumulating notes with a view to producing a performance-oriented Go training course. There's just so many techniques and tools to master! I'm hopeful for a release some time in 2026, though. 🤞 #golang

22.02.2026 14:25 👍 9 🔁 0 💬 0 📌 0
errors package - errors - Go Packages

If you've already migrated to Go 1.26, there's no longer any point in relying on github.com/jub0bs/errutil. Simply rely on errors.Astype instead.

pkg.go.dev/errors#AsType

#golang

21.02.2026 08:06 👍 3 🔁 2 💬 0 📌 0

Do tell... 🍿

19.02.2026 09:30 👍 0 🔁 0 💬 1 📌 0

An unfortunate bug snuck in v0.12.0: some middleware would disallow origins that they should have allowed. Fixed in v0.12.1. Apologies. 🙇

12.02.2026 22:02 👍 1 🔁 0 💬 0 📌 0

🙈

12.02.2026 15:49 👍 0 🔁 0 💬 0 📌 0

"If you think you need this, you're almost certainly wrong."

12.02.2026 15:33 👍 1 🔁 0 💬 1 📌 1
Preview
GitHub - jub0bs/cors: perhaps the best CORS middleware library for Go perhaps the best CORS middleware library for Go. Contribute to jub0bs/cors development by creating an account on GitHub.

🎉 I've just released v0.12.0 of jub0bs/cors, my CORS middleware library for #golang!

- Go 1.25 or above is now required.
- Some minor performance improvements.

Still guaranteed free of AI slop, of course.

github.com/jub0bs/cors

12.02.2026 15:22 👍 9 🔁 0 💬 1 📌 0
$ go install golang.org/dl/go1.26.0@latest
$ go1.26.0 download
Downloaded   0.0% (       0 / 63102509 bytes) ...
Downloaded  50.0% (31551254 / 63102509 bytes) ...
Downloaded 100.0% (63102509 / 63102509 bytes)
Unpacking go1.26.0.openbsd-arm64.tar.gz ...
Success. You may now run 'go1.26.0'
$ go1.26.0 version
go version go1.26.0 openbsd/arm64

$ go install golang.org/dl/go1.26.0@latest $ go1.26.0 download Downloaded 0.0% ( 0 / 63102509 bytes) ... Downloaded 50.0% (31551254 / 63102509 bytes) ... Downloaded 100.0% (63102509 / 63102509 bytes) Unpacking go1.26.0.openbsd-arm64.tar.gz ... Success. You may now run 'go1.26.0' $ go1.26.0 version go version go1.26.0 openbsd/arm64

🎆 Go 1.26.0 is released!

🗒️ Release notes: https://go.dev/doc/go1.26

⬇️ Download: https://go.dev/dl/#go1.26.0

#golang

10.02.2026 19:52 👍 170 🔁 47 💬 2 📌 10

💯

10.02.2026 11:17 👍 0 🔁 0 💬 1 📌 0

#golang quizz: why is the implementation of the following function naive/incorrect, and how would you fix it? 😉

// opposite returns the opposite of comparator function cmp.
func opposite[T any](cmp func(T, T) int) func(T, T) int {
return func(x, y T) int { return -cmp(x, y) }
}

10.02.2026 10:52 👍 2 🔁 0 💬 1 📌 0
Preview
cmp: add Or · Issue #60204 · golang/go An extremely common string operation is testing if a string is blank and if so replacing it with a default value. I propose adding First(...strings) string to package strings (and probably an equiv...

I must confess I regret github.com/golang/go/is.... I've since found cmp.Or to be quite useful, esp. for implementing comparator functions for struct types. Thanks to @carlana.net for pushing for its addition to #golang's standard library.

09.02.2026 11:28 👍 10 🔁 0 💬 0 📌 1

Well, I might produce a v0.12.0 to accompany Go 1.26, whose release is imminent.

08.02.2026 15:12 👍 3 🔁 0 💬 0 📌 0