Documentation
¶
Index ¶
- type FileSet
- func (fs *FileSet) AddFile(filename string, src []byte)
- func (fs *FileSet) Contains(filename string) bool
- func (fs *FileSet) Data(filename string) []byte
- func (fs *FileSet) Format() []byte
- func (fs *FileSet) MvFile(source, target string)
- func (fs *FileSet) Num() int
- func (fs *FileSet) Update(filename string, src []byte)
- type FileSystem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSet ¶
type FileSet struct {
ProgName string // default prog name
Files []string // filenames in user-provided order
M map[string][]byte // filename -> source
NoHeader bool // whether the prog.go entry was implicit
}
fileSet is a set of files. The zero value for fileSet is an empty set ready to use.
func SplitFiles ¶
splitFiles splits the user's input program src into 1 or more files, splitting it based on boundaries as specified by the "txtar" format. It returns an error if any filenames are bogus or duplicates. The implicit filename for the txtar comment (the lines before any txtar separator line) are named "prog.go". It is an error to have an explicit file named "prog.go" in addition to having the implicit "prog.go" file (non-empty comment section).
The filenames are validated to only be relative paths, not too long, not too deep, not have ".." elements, not have backslashes or low ASCII binary characters, and to be in path.Clean canonical form.
splitFiles takes ownership of src.
func (*FileSet) AddFile ¶
AddFile adds a file to fs. If fs already contains filename, its contents are replaced.
func (*FileSet) Data ¶
Data returns the content of the named file. The fileSet retains ownership of the returned slice.
type FileSystem ¶
func (*FileSystem) Base ¶
func (f *FileSystem) Base(filename string) string
func (*FileSystem) Join ¶
func (f *FileSystem) Join(elem ...string) string