Go

Go Code Screenshot Generator

Turn Go snippets into images worth sharing, without leaving your Mac.

Go's explicit error handling makes for snippets that are tall rather than wide, which changes how you should frame them.

Codeshot detects Go from the code you paste, so there is no language picker to get wrong. Here is the same snippet in three of the 30 themes it ships with, rendered with the app's own stylesheets.

package snapshot

import "image/png"

// Export renders the snippet and writes it to path.
func Export(s Snippet, path string) error {
	img, err := Render(s)
	if err != nil {
		return err
	}
	return png.Encode(mustCreate(path), img)
}
Edge · dark
package snapshot

import "image/png"

// Export renders the snippet and writes it to path.
func Export(s Snippet, path string) error {
	img, err := Render(s)
	if err != nil {
		return err
	}
	return png.Encode(mustCreate(path), img)
}
GitHub · dark
package snapshot

import "image/png"

// Export renders the snippet and writes it to path.
func Export(s Snippet, path string) error {
	img, err := Render(s)
	if err != nil {
		return err
	}
	return png.Encode(mustCreate(path), img)
}
Tokyo Night · dark

Choosing a theme for Go

Because Go code stacks vertically, a portrait ratio wastes less space than the default landscape, and reads better in a mobile feed.

Getting the size right

Let the image follow your content, or lock it to a ratio — 1:1, 4:3, 3:2, 16:9, 9:16, 2:3, or 3:4 — then export at 1×, 2×, or 3× so it stays sharp on a retina display. Copy it straight to the clipboard with C, or save with S.

See all 30 themes side by side, or read the full workflow.

Built for Go, and 59 other languages

Everything runs on your Mac. Your code never leaves it.

Download for macOS