util

package
v0.0.0-...-8f5c598 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2015 License: MIT Imports: 6 Imported by: 4

Documentation

Overview

Package util provides utility functions for use throughout the application. Theses include File/Directory manipulation functions and an exported function for accessing the stored configuration for the application.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigPath is an exported pacakge variable for declaring
	// the location of the application configuration file. This
	// can be set using the -c application flag when starting
	// the application via the command line.
	ConfigPath = "./_private/app.config"
)

Functions

func Config

func Config() config

Config provides an exported facility for accessing the application configuration throughout the application. It returns the current value held by the unexported conf. If blank, it will read from the configuration file located at ConfigPath or the default configuration if ConfigPath does not exist.

func DefaultConfig

func DefaultConfig() config

DefaultConfig returns a set of default configuration values needed to run the application.

func MakeDir

func MakeDir(dir string) error

MakeDir creates the directory dir and all parent directories if they do not exist. It will return nil on success or if the directory already exists, otherwise, an error is returned.

func Markdown

func Markdown(str interface{}) []byte

Markdown presents MarkdownCommon with a few minor changes

func WriteFile

func WriteFile(name string, contents interface{}) error

Write file writes contents to name. If necessary, it handles type casting from string to []byte. It returns an error if there are any issues writing the file contents.

Types

type FileReading

type FileReading struct {
	// Filename is a application relative path of a file.
	Filename string
	Info     os.FileInfo
}

func ReadDir

func ReadDir(dir string) []FileReading

ReadDir reads dir contents recursively. It returns a slice of FileReading on completion.

Jump to

Keyboard shortcuts

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