Add some missing doc comments

As pointed out by the linter, some exported functions and types are
missing doc comments.
The linter warnings have been reduced from 194 to 116.
Not all missing comments have been added in this commit though.
This commit is contained in:
Jorin Vogel
2017-08-02 14:25:05 +02:00
committed by Bjørn Erik Pedersen
parent 9891c0fb0e
commit 81c13171a9
30 changed files with 109 additions and 23 deletions

View File

@@ -29,14 +29,17 @@ func New() *Namespace {
// Namespace provides template functions for the "math" namespace.
type Namespace struct{}
// Add adds two numbers.
func (ns *Namespace) Add(a, b interface{}) (interface{}, error) {
return DoArithmetic(a, b, '+')
}
// Div divides two numbers.
func (ns *Namespace) Div(a, b interface{}) (interface{}, error) {
return DoArithmetic(a, b, '/')
}
// Log returns the natural logarithm of a number.
func (ns *Namespace) Log(a interface{}) (float64, error) {
af, err := cast.ToFloat64E(a)
@@ -84,10 +87,12 @@ func (ns *Namespace) ModBool(a, b interface{}) (bool, error) {
return res == int64(0), nil
}
// Mul multiplies two numbers.
func (ns *Namespace) Mul(a, b interface{}) (interface{}, error) {
return DoArithmetic(a, b, '*')
}
// Sub substracts two numbers.
func (ns *Namespace) Sub(a, b interface{}) (interface{}, error) {
return DoArithmetic(a, b, '-')
}