misc

package
v0.0.0-...-c859fe7 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2015 License: MIT Imports: 1 Imported by: 0

README

Misc

This package contains random functions that I didn't know where to put. By now there's only the EnvOrElse function. This function is similar to Python's get but this one deals with environment variables. An example:

package main

import (
	"fmt"

	"github.com/mssola/go-utils/misc"
)

func main() {
	home := misc.EnvOrElse("HOME", "/home/user")
	fmt.Printf("%v\n", home) // => /home/mssola
	home = misc.EnvOrElse("HOM", "/home/user")
	fmt.Printf("%v\n", home) // => /home/user
}

Copyright © 2014-2015 Miquel Sabaté Solà, released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvOrElse

func EnvOrElse(name, value string) string

Get the value of the given environment variable. If this environment variable is not set, then the given default value will be returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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