Documentation ¶
Overview ¶
Package gg is a set of useful golang utilities.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func If ¶
If returns truePart if cond is true, or returns falsePart. Something like ternary operator in C:
cond ? truePart : falsePart
func IfFunc ¶
IfFunc calls truePart() and returns it's return value if cond is true, or calls falsePart() and returns it's return value. If cond is true, falsePart will not be executed. if cond if false, truePart will not be executed. Something like ternary operator in C:
cond ? truePart() : falsePart()
func Must ¶
Must returns v if err is nil, or it panic with err. Must is useful to wrap a function call returning value and error when there is no better way to handle the error other than panicking.
Example ¶
package main import ( "fmt" "strconv" "github.com/mkch/gg" ) func main() { fmt.Print(gg.Must(strconv.Atoi("1"))) }
Output: 1
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.