Help us shape the future of Go! Take the 2026 Go Developer Survey

dotenv

package module
v0.0.0-...-02e4501 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 3 Imported by: 0

README

go-dotenv

CircleCI

A dotenv built with golang.

Installation

go get github.com/bmf-san/go-dotenv

Get Started

Add a .env file in your project.

FOO=foo
BAR=bar

Then you can load env file like this.

package main

import (
	"fmt"
	"os"

	"github.com/bmf-san/go-dotenv"
)

func main() {
	if err := dotenv.LoadEnv(); err != nil {
		fmt.Printf("%s", err)
	}

	fmt.Println(os.Getenv("FOO")) // foo
	fmt.Println(os.Getenv("BAR")) // bar
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnv

func LoadEnv(filenames ...string) error

LoadEnv load env variables from .env.

Types

This section is empty.

Jump to

Keyboard shortcuts

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