metavars

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package metavars allows manipulation of "meta variables" stored as variable declarations in Go files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w io.Writer, f *File) error

Write file f to write w.

func WriteFile

func WriteFile(filename string, f *File) error

WriteFile writes f to the given file.

Types

type File

type File struct {
	Package    string
	Properties []Property
}

File of property definitions.

func Read

func Read(r io.Reader) (*File, error)

Read properties from the given reader.

func ReadFile

func ReadFile(filename string) (*File, error)

ReadFile reads properties file.

func (*File) Add

func (f *File) Add(p Property) error

Add property to the file, which must not already exist.

func (*File) Get

func (f *File) Get(name string) (string, bool)

Get property with given name.

func (*File) Set

func (f *File) Set(name, value string) error

Set property name to value. The property must exist.

type Property

type Property struct {
	Name  string
	Doc   string
	Value string
}

Property is a string variable.

Jump to

Keyboard shortcuts

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