Last active
August 6, 2021 10:57
-
-
Save percybolmer/7224f3ee87167028a406e8f9e6922a53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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