gogen

package
v0.0.0-...-49e18aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gogen writes the Go source file that declares the converted icons.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPrefix

func CheckPrefix(prefix string) error

CheckPrefix rejects a prefix that cannot begin an exported Go identifier. A leading digit is allowed because Ident supplies the leading X.

func Ident

func Ident(prefix, path string) string

Ident derives an exported Go identifier from an SVG file path, with prefix prepended: "arrow-left.svg" becomes "ArrowLeft". A name that would otherwise start with a digit gains an "X", since Go identifiers cannot. The prefix goes on before that patch-up, so a prefix already supplies the leading letter.

func Source

func Source(pkg, notice string, icons []Icon, byteSlices bool) ([]byte, error)

Source returns gofmt'd Go source declaring every icon, in the order given. byteSlices declares them as mutable []byte variables rather than string constants.

pkg must be a valid package name and notice valid UTF-8; the caller checks both, so that it can name the option that was wrong.

Types

type Icon

type Icon struct {
	Source string
	Name   string
	Data   []byte
}

Icon is one converted file: where the artwork came from, the identifier it is declared under, and its IconVG encoding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL