Skip to content
Release

October releases: two that break, two you shouldn't skip

go-migration v1.2.0 and open-swag-go v1.3.0 break code in a minor release; go-audit and go-notification ship fixes you want. What to change, per package.

Andrian Prasetya Andrian Prasetya

All four gopackx packages shipped on 18 October. Two of them — go-migration v1.2.0 and open-swag-go v1.3.0 — are minor releases that break code, which semver says they shouldn’t. The other two are patches you shouldn’t skip: go-audit v1.1.1 stops a SQLite purge from deleting fresh rows, and go-notification v1.0.2 keeps API tokens out of your logs. Here’s what to change, package by package.

PackageReleaseBreakingWhat you need to do
go-migrationv1.2.0YesSwap migrator.Run() for app.Run(); allow two connections
open-swag-gov1.3.0YesDrop imports of removed packages; regenerate client types
go-auditv1.1.1NoUpgrade core and adapters; check SQLite retention jobs
go-notificationv1.0.2NoUpgrade; check mail drivers registered under a custom name

If you’re still on v1.0.x, read the releases in between first — go-migration v1.1.0, go-audit v1.1.0, and open-swag-go v1.1.x and v1.2.0 — in the go-migration, go-audit, and open-swaggo changelogs.

go-migration v1.2.0

The headline is a cross-process migration lock, on by default. Two pods starting at once no longer race to apply the same migration: PostgreSQL takes pg_try_advisory_lock, MySQL takes GET_LOCK, and SQLite relies on its file lock. SQLite also moved to the pure-Go modernc.org/sqlite driver, so a CLI built with CGO_ENABLED=0 still talks to SQLite — the prebuilt binaries up to v1.1.0 were built that way and quietly couldn’t.

migrate:status --check exits with status 1 when anything is pending, which makes it a readiness gate for a Kubernetes initContainer or a CI step.

Three things can break on upgrade.

The CLI moved out of the library. Importing pkg/migrator no longer pulls in the CLI, the config loader, or the YAML parser. Your cmd/migrator/main.go changes in two imports and one call:

go cmd/migrator/main.go Before
import (
	"github.com/gopackx/go-migration/pkg/migrator"

	_ "github.com/lib/pq"
	_ "github.com/mattn/go-sqlite3"
	_ "myapp/database/migrations"
)

func main() {
	migrator.Run()
}
go cmd/migrator/main.go After
import (
	"github.com/gopackx/go-migration/pkg/cli/app"

	_ "github.com/lib/pq"
	_ "modernc.org/sqlite"
	_ "myapp/database/migrations"
)

func main() {
	app.Run()
}

The lock needs a pool of two. On PostgreSQL and MySQL a pool capped at one open connection now fails with an error that says so. Raise the cap, or opt out with migrator.WithoutLock() or --no-lock. Behind PgBouncer in transaction mode, connect the migrator directly — a session-level advisory lock doesn’t survive transaction pooling.

Custom grammars need updating. If you implement schema.Grammar yourself, CompileCreate now returns a slice of statements and there are seven new methods. The go-migration changelog lists them.

$ go get github.com/gopackx/go-migration@v1.2.0

open-swag-go v1.3.0

This release is about the spec being right. Five bugs made the generated openapi.json wrong for code generators: router-style paths like /users/:id written as-is, unexported embedded structs dropped, a duplicate route silently replacing the first, pointer fields missing null, and operations without an operationId. All five are fixed. Named structs are now emitted once under components.schemas and referenced with $ref, so openapi-typescript and orval generate named types instead of anonymous objects.

I also deleted packages that never did anything. Nothing in the handler, the spec builder, or the docs page called them, so configuring them had no effect. Code that imports them no longer compiles, which is the honest outcome.

Removed in v1.3.0 Use instead
auth.BearerAuth(description) openswag.BearerAuth(name) in Config.Auth.Schemes
pkg/tryit, pkg/tryit/snippets Nothing: the try-it console and snippets come from Scalar
ui.GetTheme, ui.PredefinedThemes UIConfig.Theme, passed to Scalar as-is
examples.NewFaker, Config.UseFaker examples.New and Generate

Your generated clients will change. Pointer fields now come out as string | null, so frontend code may need null checks. Every operation has an operationId, and orval names its hooks after it, so generated names can shift; set Endpoint.OperationID where you need a stable one. If you can’t regenerate clients yet, InlineSchemas: true on Config restores the old inline output.

Then call docs.Validate() once after AddAll. If it reports a duplicate, one of your endpoints was missing from the spec before. The open-swaggo changelog has the full migration list.

$ go get github.com/gopackx/open-swag-go@v1.3.0

go-audit v1.1.1

If you run go-audit on SQLite, upgrade this one first. SQLite has no time type, so the driver binds a time.Time as text with its zone offset, and SQLite compares the strings. A purge cutoff built in UTC+7 (20:00:00+07:00) sorted after every UTC row written in the same hour (14:00:00+00:00), so Purge(time.Now().Add(-time.Hour)) deleted rows it should have kept. The SQL store now converts every time parameter to UTC before binding. PostgreSQL and MySQL already compared instants.

The Bun and Ent adapters now honour ErrorFailLoud, which they used to discard. Ent mutations return the audit error alongside the applied result. Bun can’t fail a query from its hook, so it reports through a handler you can replace with auditbun.WithErrorHandler. If your code assumed Ent writes never fail because of the audit store, wrap them in a transaction or set that table to ErrorFailSilent. Separately, adapters/gorm v1.1.3 stops primary-key updates from snapshotting the whole table, and audits bulk Where(...).Update and Delete per row with real IDs instead of one entry with entity_id "0".

bash
go get github.com/gopackx/go-audit@v1.1.1
go get github.com/gopackx/go-audit/adapters/gorm@v1.1.3  # GORM users
go get github.com/gopackx/go-audit/adapters/bun@v1.1.1   # Bun users
go get github.com/gopackx/go-audit/adapters/ent@v1.1.1   # Ent users

The MCP server picks up the same fix in mcp/v1.1.2, and since mcp/v1.1.1 it works with go install — earlier tags carried a local replace that broke it. The go-audit changelog has the rest.

go-notification v1.0.1 and v1.0.2

No API changes, but fixes you’d want anyway. An async Send used to inherit the caller’s context, so a request context cancelled right after Send returned could abort the delivery and its retries. It now runs on context.WithoutCancel(ctx): trace IDs and loggers come along, cancellation doesn’t. Use notification.Sync() when cancellation should apply. And a Send racing Close could panic with “send on closed channel”; it now reports ErrClosed through OnError.

HTTP driver errors now carry only the scheme and host of the request URL, so Telegram bot tokens and Slack, Discord, and Teams webhook URLs stop leaking through error messages, and the notifier’s own log lines go through middleware.Redact. The err passed to Config.OnError is still unredacted, so redact it before you log it. The repo also has a SECURITY.md now.

One change to check: a mail driver registered under a custom name such as mail_tx now asks your notifiable for RouteNotificationFor("mail_tx"), not "mail". The go-notification changelog covers the SMTP and retry fixes too.

$ go get github.com/gopackx/go-notification@v1.0.2

Upgrade order

If you use more than one package, start with go-audit and go-notification — they’re drop-in. Then go-migration, where the main.go change is mechanical but the pool limit needs checking against each environment. Leave open-swag-go for a change where you can regenerate your clients at the same time. If an upgrade breaks in a way this post doesn’t cover, open an issue on that package’s repo.