Documentation
¶
Overview ¶
Package noodle helps embedding static assets into go binary, it supports using ignore file
Index ¶
- Constants
- func CleanLine(line string) string
- func GenerateEmbedBytes(cfgs []EmbedConfig) ([]byte, error)
- func GenerateEmbedFile(cfg EmbedConfig) error
- func GenerateEmbedPartial(cfg EmbedConfig) ([]byte, error)
- func LineToPattern(line string) fsutil.IgnorePattern
- func ReadIgnore(reader io.Reader) (*fsutil.Ignores, error)
- func ReadIgnoreFile(path string) (*fsutil.Ignores, error)
- type Bowel
- type EmbedBowel
- type EmbedConfig
- type EmbedDir
- type EmbedFile
- type FileInfo
- type LocalFs
Constants ¶
const ( DefaultIgnoreFileName = ".noodleignore" DefaultName = "Bowel" )
Variables ¶
This section is empty.
Functions ¶
func GenerateEmbedBytes ¶ added in v0.0.8
func GenerateEmbedBytes(cfgs []EmbedConfig) ([]byte, error)
GenerateEmbedBytes return a single formatted go file as bytes from multiple source directories. Use GenerateEmbedFile if you just have one source directory and want to write to file directly. it's header + package + []GenerateEmbedPartial
func GenerateEmbedFile ¶ added in v0.0.8
func GenerateEmbedFile(cfg EmbedConfig) error
GenerateEmbedFile generates contents from cfg.Src and save it to a single go file in cfg.Dst. It's a wrapper around GenerateEmbedBytes
func GenerateEmbedPartial ¶ added in v0.0.8
func GenerateEmbedPartial(cfg EmbedConfig) ([]byte, error)
GenerateEmbedPartial return code WITHOUT header and import, use GenerateEmbedBytes if you want a full go file
func LineToPattern ¶
func LineToPattern(line string) fsutil.IgnorePattern
func ReadIgnore ¶
ReadIgnore reads ignore file and change to patterns reading is based on https://github.com/codeskyblue/dockerignore/blob/HEAD/ignore.go#L40
Types ¶
type Bowel ¶ added in v0.0.8
type Bowel interface {
http.FileSystem
}
Bowel is the container for different types of noodles
type EmbedBowel ¶ added in v0.0.8
type EmbedBowel struct {
Dirs map[string]EmbedDir
Data []byte
// contains filtered or unexported fields
}
func (*EmbedBowel) ExtractFiles ¶ added in v0.0.8
func (b *EmbedBowel) ExtractFiles() error
type EmbedConfig ¶ added in v0.0.8
type FileInfo ¶
type FileInfo struct {
FileName string
FileSize int64
FileMode os.FileMode
FileModTime time.Time
FileIsDir bool
}
FileInfo is a concrete struct that implements os.FileInfo interface Its fields have the awkward File* prefix to avoid conflict with os.FileInfo interface
func NewFileInfo ¶
type LocalFs ¶
type LocalFs struct {
// contains filtered or unexported fields
}
func NewLocal ¶
NewLocal returns a http.FileSystem using local directory, both list directory and index.html are disabled it is a wrapper around http.Dir
func NewLocalUnsafe ¶
NewLocalUnsafe allows list directory and use http.Dir directly