Go comments displayed due to Write tool are are incorrectly rendered. #2199

Open
opened 2026-02-16 17:34:38 -05:00 by yindo · 1 comment
Owner

Originally created by @SamInTheShell on GitHub (Oct 20, 2025).

Originally assigned to: @thdxr on GitHub.

Description

The Write models/user.go preview displays this:

Write models/user.go

package models

 User represents a user with a username and password.
 Passwords should be stored hashed in production, but for this
 example we keep them plain.
type User struct {
    ID       uint   `gorm:"primaryKey"`
    Username string `gorm:"unique;not null"`
    Password string `gorm:"not null"`
}

I was kinda surprised the // was missing, because this model is dumb, but not that dumb.

So I let it write the file and this is what it produced:

❯  cat models/user.go
package models

// User represents a user with a username and password.
// Passwords should be stored hashed in production, but for this
// example we keep them plain.
type User struct {
	ID       uint   `gorm:"primaryKey"`
	Username string `gorm:"unique;not null"`
	Password string `gorm:"not null"`
}

OpenCode version

v0.15.10

Steps to reproduce

Just ask a model to wrote some Go with lines of // comments.

Screenshot and/or share link

A screenshot of this issue can be found here: https://gist.githubusercontent.com/SamInTheShell/6f9c42b8f15c5b72357ab19dd6130f66/raw/547056dbde6133bad80bd7622c044323448e88d3/go-comment-render-issue.png

Operating System

macos

Terminal

iTerm2

Originally created by @SamInTheShell on GitHub (Oct 20, 2025). Originally assigned to: @thdxr on GitHub. ### Description The `Write models/user.go` preview displays this: ``` Write models/user.go package models User represents a user with a username and password. Passwords should be stored hashed in production, but for this example we keep them plain. type User struct { ID uint `gorm:"primaryKey"` Username string `gorm:"unique;not null"` Password string `gorm:"not null"` } ``` I was kinda surprised the `//` was missing, because this model is dumb, but not that dumb. So I let it write the file and this is what it produced: ```shell ❯ cat models/user.go package models // User represents a user with a username and password. // Passwords should be stored hashed in production, but for this // example we keep them plain. type User struct { ID uint `gorm:"primaryKey"` Username string `gorm:"unique;not null"` Password string `gorm:"not null"` } ``` ### OpenCode version v0.15.10 ### Steps to reproduce Just ask a model to wrote some Go with lines of `// comments`. ### Screenshot and/or share link A screenshot of this issue can be found here: https://gist.githubusercontent.com/SamInTheShell/6f9c42b8f15c5b72357ab19dd6130f66/raw/547056dbde6133bad80bd7622c044323448e88d3/go-comment-render-issue.png ### Operating System macos ### Terminal iTerm2
yindo added the bug label 2026-02-16 17:34:38 -05:00
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

This will be fixed by our soon to ship rewrite

@rekram1-node commented on GitHub (Oct 21, 2025): This will be fixed by our soon to ship rewrite
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2199