Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 6, 2021 10:57
Show Gist options
  • Save percybolmer/7224f3ee87167028a406e8f9e6922a53 to your computer and use it in GitHub Desktop.
Save percybolmer/7224f3ee87167028a406e8f9e6922a53 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"os"
"github.com/joho/godotenv"
jira "gopkg.in/andygrunwald/go-jira.v1"
)
func main() {
// Load the .env file
godotenv.Load(".env")
// Create a BasicAuth Transport object
tp := jira.BasicAuthTransport{
Username: os.Getenv("JIRA_USER"),
Password: os.Getenv("JIRA_TOKEN"),
}
// Create a new Jira Client
client, err := jira.NewClient(tp.Client(), os.Getenv("JIRA_URL"))
if err != nil {
log.Fatal(err)
}
me, _, err := client.User.GetSelf()
if err != nil {
log.Fatal(err)
}
log.Println(me)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment