Skip to content

Instantly share code, notes, and snippets.

@suzuki-shunsuke
Created October 12, 2024 02:27
Show Gist options
  • Save suzuki-shunsuke/822f11c9d52ea71bc051e260a6f8adb4 to your computer and use it in GitHub Desktop.
Save suzuki-shunsuke/822f11c9d52ea71bc051e260a6f8adb4 to your computer and use it in GitHub Desktop.
Example of zalando/go-keyring
package main
import (
"fmt"
"log"
"github.com/zalando/go-keyring"
)
func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}
func run() error {
//
service := "test-aquaproj-aqua"
user := "GITHUB_TOKEN"
secret, err := keyring.Get(service, user)
if err != nil {
return err
}
fmt.Println("GITHUB_TOKEN", secret)
return nil
}
package main
import (
"log"
"github.com/zalando/go-keyring"
)
func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}
func run() error {
service := "test-aquaproj-aqua"
user := "GITHUB_TOKEN"
password := "secret"
if err := keyring.Set(service, user, password); err != nil {
return err
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment