Documentation ¶
Index ¶
- Constants
- Variables
- func Compile(sources []*Source, filePath string, pkgName string, varName string, opts *Opts) error
- func Retrieve(sources []*Source) (http.FileSystem, error)
- type Archive
- type ArchiveError
- type ArchiveFormat
- type Checksum
- type ChecksumAlgo
- type ChecksumError
- type Opts
- type PathMapper
- type RetrieveError
- type Source
Constants ¶
const ( // Zip is the zip file format. Zip = iota // TarGz is the tar.gz file format. TarGz )
const ( // MD5 is the MD5 algorithm. MD5 = iota // SHA1 is the SHA1 algorithm. SHA1 // SHA256 is the SHA256 algorithm. SHA256 // SHA512 is the SHA512 algorithm. SHA512 )
Variables ¶
var ( // ErrChecksumMismatch is returned when the expected checksum differs from the calculated one ErrChecksumMismatch = errors.New("checksum mismatch") // ErrChecksumUnknown is returned when an invalid checksum algorithm is specified ErrChecksumUnknown = errors.New("unknown checksum algorithm") )
var ( // ErrArchiveUnknown is returned when an invalid archive format is specified ErrArchiveUnknown = errors.New("unknown archive format") )
var ( // ErrNoMatch is returned when the glob does not match any file. ErrNoMatch = errors.New("no match") )
Functions ¶
Types ¶
type Archive ¶
type Archive struct { Format ArchiveFormat PathMapper PathMapper }
Archive describes an archive format for the asset source.
type ArchiveError ¶
ArchiveError is returned when there is a problem processing the archive
func (*ArchiveError) Error ¶
func (e *ArchiveError) Error() string
type Checksum ¶
type Checksum struct { Algo ChecksumAlgo Value string }
Checksum describes a checksum verification for an asset source.
type ChecksumError ¶ added in v0.3.0
ChecksumError is returned when there is a checksum problem with an asset source
func (*ChecksumError) Error ¶ added in v0.3.0
func (e *ChecksumError) Error() string
type Opts ¶ added in v0.2.0
type Opts struct { // BuildTags are the build tags in the generated source code. // Defaults to no tags. BuildTags string // VariableComment is the comment of the variable in the generated source code. // Defaults to "<VariableName> implements a http.FileSystem.". VariableComment string }
Opts provides optional parameters to the Compile function.
type PathMapper ¶
PathMapper specifies a function that is executed on all files in the archive. The mapper receives the full path to each file in the archive and returns the path to use in the asset file system. If "" is returned, the file is dropped.
func ReMap ¶ added in v0.2.2
func ReMap(pattern string, replacement string) PathMapper
ReMap returns a PathMapper that compares file paths to the input pattern and maps matches to the replacement string (see Regexp.ReplaceAllString).
type RetrieveError ¶
RetrieveError is returned when there is a problem retrieving an asset source
func (*RetrieveError) Error ¶
func (e *RetrieveError) Error() string