embedhash

package module
v0.0.0-...-c9d967b Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2025 License: MIT Imports: 13 Imported by: 0

README

embedhash

Go Reference Go Report Card

Generate a map with hashes for all embedded files. See Go Reference for documentation.

Let's say we have valid.go that has embedded files.

package valid

import "embed"

//go:embed test.md uhoh/*
var _ embed.FS

By running embedhash, we can generate embedhash.go that has the hashes for all the files being embedded.

// Code generated by embedhash, DO NOT EDIT.
package valid

var HashesForEmbedded = map[string]string{
	"test.md":      "ceb0947a7db674632116cb7fefb5424e",
	"uhoh/uhoh.go": "07e16a3b94e2bd127b42ce10d4d99c43",
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

func Hasher

func Hasher(h hash.Hash) Option

func OutputFileName

func OutputFileName(filename string) Option

func OutputVarName

func OutputVarName(varName string) Option

type Result

type Result struct {
	Filename string
	PkgName  string
	VarName  string
	Data     map[string]string
}

func New

func New(dir string, opts ...Option) ([]*Result, error)

func (Result) Save

func (r Result) Save(w io.Writer) error

Directories

Path Synopsis
cmd
embedhash command
internal
valid
Code generated by embedhash, DO NOT EDIT.
Code generated by embedhash, DO NOT EDIT.

Jump to

Keyboard shortcuts

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