Categorygithub.com/akumria/netrc
repositorypackage
0.0.0-20190521160308-8b57f88dd986
Repository: https://github.com/akumria/netrc.git
Documentation: pkg.go.dev

# README

netrc Build Status GoDoc

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()