Developer tools
Code the packages write for you: a seeder from the rows in the database, a migration from the live schema, a log viewer for the log files and a fake logger for tests.
seedgen
go run . iseed posts writes this file to database/seeders/posts_table_seeder.go.
Here it is generated for the first three posts without their body.
package seeders
import (
"context"
"time"
"go.laravel.com/db"
)
// postsTableSeeder is an auto generated seeder for the `posts` table.
func postsTableSeeder(ctx context.Context) error {
if _, err := db.Table("posts").Delete(ctx); err != nil {
return err
}
if err := db.Table("posts").Insert(ctx,
db.Values{
"id": 1,
"category_id": 4,
"locale": "en",
"title": "Hello from Laravel Go",
"slug": "hello-from-laravel-go",
"status": "published",
"views": 111,
"published_at": time.Date(2026, time.January, 5, 9, 0, 0, 0, time.UTC),
"created_at": time.Date(2026, time.January, 5, 9, 0, 0, 0, time.UTC),
"updated_at": time.Date(2026, time.January, 5, 9, 0, 0, 0, time.UTC),
},
db.Values{
"id": 2,
"category_id": 4,
"locale": "tr",
"title": "Çalışma Şekli",
"slug": "calisma-sekli",
"status": "published",
"views": 148,
"published_at": time.Date(2026, time.January, 16, 9, 0, 0, 0, time.UTC),
"created_at": time.Date(2026, time.January, 16, 9, 0, 0, 0, time.UTC),
"updated_at": time.Date(2026, time.January, 16, 9, 0, 0, 0, time.UTC),
},
db.Values{
"id": 3,
"category_id": 4,
"locale": "en",
"title": "Routing in Five Minutes",
"slug": "routing-in-five-minutes",
"status": "published",
"views": 185,
"published_at": time.Date(2026, time.February, 5, 9, 0, 0, 0, time.UTC),
"created_at": time.Date(2026, time.February, 5, 9, 0, 0, 0, time.UTC),
"updated_at": time.Date(2026, time.February, 5, 9, 0, 0, 0, time.UTC),
},
); err != nil {
return err
}
return nil
}
migrationgen
go run . migrate:generate reads the database and writes a migration per table. This is
the one for posts, read from the live schema.
package migrations
import (
"context"
"go.laravel.com/schema"
)
func createPostsTable(ctx context.Context) error {
return schema.Create(ctx, "posts", func(table *schema.Blueprint) {
table.ID()
table.Integer("category_id").Nullable()
table.String("locale").Default("en")
table.String("title")
table.String("slug").Unique()
table.Text("body")
table.String("status").Default("draft")
table.Integer("views").Default(0)
table.Timestamp("published_at").Nullable()
table.Timestamps()
})
}
logviewer
LOGVIEWER_ENABLED=true and then only the admin account may open it.
Laravel Go logs to stderr by default; the viewer reads the daily files, so .env needs
LOG_CHANNEL=stderr,daily. This app logs the spreadsheet imports and the missing URLs.
logfake
In a test, the fake replaces the logger and captures every line, so a test can assert what a handler logged without reading a file. It is installed by the tests only.
fake := logfake.New(t)
t.Cleanup(logfake.SetDefault(fake))
client := tests.New(t, logfake.Use(fake))
client.Get("/no-such-page").AssertNotFound()
fake.AssertLogged(func(e logfake.Entry) bool {
return e.Level == "warning" && e.Message == "404 not found"
})