Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 704 Bytes

README.md

File metadata and controls

22 lines (16 loc) · 704 Bytes

go-netrc GoDoc CircleCI

A netrc parser for Go.

Usage

Getting credentials for a host.

usr, err := user.Current()
n, err := netrc.Parse(filepath.Join(usr.HomeDir, ".netrc"))
fmt.Println(n.Machine("api.heroku.com").Get("password"))

Setting credentials on a host.

usr, err := user.Current()
n, err := netrc.Parse(filepath.Join(usr.HomeDir, ".netrc"))
n.Machine("api.heroku.com").Set("password", "newapikey")
n.Save()