Episode #12— Github & Git & Jira integration with Golang

Stephens Xu
Fullstack Network
Published in
2 min readMay 31, 2017

--

We are changing our approach a bit, as Avi announced yesterday that we will be doing streaming every day for this week, and we will be working on smaller side projects.

In this session, we started building Gong, a CLI tool built with Go intended to automate workflow of engineers.

Video:

Jira is a project management tool. Just like many others, it has a web UI interface where people create, comment and track projects. It also offers an API.

Efficiency is important for engineers and this would be a really nice tool to save the time of opening up browser, moving mouse and clicking around, all the minutes add up!

Gong is 100% open sourced and any issues or suggestions are welcomed.

The first step of our CLI tool is to prompt the user to enter their Jira credentials and save those data in use’s $HOME directory for future use, such as when making future API requests.

We used the great cli that provides many freebies related to cli related interactions, such as prompting user to enter information and parsing the responses. Once you import the library, you can something nice like this:

func main() {
app := cli.NewApp()
app.Commands = []cli.Command{
{
Name: "login",
Usage: "Login to your Jira Instance",
Action: func(c *cli.Context) error {
username := prompt.String("What is your Jira username/email?")
password := prompt.PasswordMasked("What is your password?")
domain := prompt.String("What is the jira instance URL?")
loginDetails := gong.NewLoginDetails(username, password, domain)
err := loginDetails.Verify()
err = loginDetails.Save()

return nil
},
},
}
app.Run(os.Args)
}

Here gong.NewLoginDetails is another simple function that creates an ini file format containing the user credentials and then save that to our desired directory.

Now that we have a way to persisting user credentials on the disk, next step would be building the API integration that would allow us to talk to Jira and github all from the command line. This will be our work in tonight’s session, join us if this interest you!

--

--