config

package
v4.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectoryPath

func DirectoryPath() string

DirectoryPath returns the absolute path to the application's directory.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

File models a config file in the application's directory.

func NewFile

func NewFile(name string) *File

NewFile creates a new config file with the given name in the application's directory.

func (*File) Exists

func (file *File) Exists() bool

Exists checks whether the file exists with suitable permissions as a file and not as a directory.

func (*File) Path

func (file *File) Path() string

Path returns the absolute path to the config file.

func (*File) ReadJSON

func (file *File) ReadJSON(object interface{}) error

ReadJSON reads the config file as JSON to the given object. Make sure the config file exists!

func (*File) Remove

func (file *File) Remove() error

Remove removes the file.

func (*File) WriteJSON

func (file *File) WriteJSON(object interface{}) error

WriteJSON writes the given object as JSON to the config file.

Jump to

Keyboard shortcuts

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