Example #1
0
func set_value(service, path, value string) {
	err := keyring.Set(service, path, value)
	if err != nil {
		fmt.Println("error:", err)
		os.Exit(1)
	}
}
Example #2
0
func main() {
	if pw, err := keyring.Get("keyring_example", "jack"); err == nil {
		fmt.Println("current stored password:"******"no password stored yet")
	} else {
		fmt.Println("got unexpected error:", err)
		os.Exit(1)
	}
	pw, err := gopass.GetPass("enter new password: "******"setting keyring_example/jack to..", pw)
	err = keyring.Set("keyring_example", "jack", pw)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Println("fetching keyring_example/jack..")
	if pw, err := keyring.Get("keyring_example", "jack"); err == nil {
		fmt.Println("got", pw)
	} else {
		fmt.Println("error:", err)
	}
}
func ExampleGet() {
	keyring.Set("keyring-test", "jack", "test password")
	pw, _ := keyring.Get("keyring-test", "jack")
	fmt.Println("pw:", pw)
	// don't ignore errors like this in your code
	// Output:
	// pw: test password
}