go-jira
go-jira copied to clipboard
[issue] - Example "Create an Issue" Failing
Describe the bug
The example on "Create an Issue" runs into a panic with a status code: 400
.
Formatting tips: GitHub supports Markdown: https://guides.github.com/features/mastering-markdown/
To Reproduce
Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include configuration, logs, etc. to reproduce, if relevant.
- Simply copy the example from the README of the repository and paste it into an editor.
- Run the build to produce a target binary.
- Execute the target binary and you will be presented with the error seen below.

Expected behavior
The expected behavior should be that it creates the ticket and exits the program successfully.
Possible Solution
Removing the Reporter
and Assignee
field from the IssueFields
creates the ticket as expected but another situation occurs. Apparently dereferencing the pointers from issue
to i
in the print statement causes another panic: runtime error: invalid memory address or nil pointer dereference
as seen below.

Changing issues.Fields.Summary
to i.Fields.Summary
gets the entire example to be working as expected.
Your Environment
Include as many relevant details about the environment you experienced the problem in
- go-jira version (git tag or sha): de60bbe
- Go version (
go version
): go1.14.6 darwin/amd64 - Jira version: I believe it is the latest since I can't seem to get the version tag off "Inspect Element"
- Jira type (cloud or on-premise): Cloud
- Involved Jira plugins: None
- Operating System and version: Mac OS
Hi! Thank you for taking the time to create your first issue! Really cool to see you here for the first time. Please give us a bit of time to review it.
I'm experiencing a very similar issue except that I can use the Assignee field, just not the Reporter field.
Additionally, when I remove the Reporter field and use jc.Issue.Create(), the issue is created successfully with all fields populated as expected but the issue struct returned from the call has Fields = nil.
If it helps, my environment: go-jira version: 1.12.0 go version: go1.14 darwin/amd64 jira version: 8.3.2 Jira type: On-premise Involved Jira plugins: none OS and version: Mac OS Catalina 10.15.6
+1 I see the exact same behavior.
Thank you for your issue your issue report. I appreciate your patience as we work to get a new maintainer up to speed to help out on this project.
After looking at the Jira docs, it looks like they require an account id for assignee and reporter. Testing it out with the following snip worked:
Assignee: &jira.User{
AccountID: "<A Jira User ID here>",
},
Reporter: &jira.User{
AccountID: "<A Jira User ID here>",
},
The custom required fields in Jira project should also be checked as there's no generic form of it, and it could be different per each project.
For example, this is my company's project requirement
which of course is not included in the generic example
Hey,
I am very sorry that this issue has been open for a long time with no final solution. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.
However, there is news: We are kicking off v2 of this library 🚀
To provide visibility, we created the Road to v2 Milestone and calling for your feedback in https://github.com/andygrunwald/go-jira/issues/489
The development will take some time; however, I hope you can benefit from the changes. If you seek priority development for your issue + you like to sponsor it, please contact me.
What does this mean for my issue?
We will work on this issue indirectly. This means that during the development phase, we aim to tackle it. Maybe in a different way like it is currently handled. Please understand that this will take a while because we are running this in our spare time.
Final words
Thanks for using this library. If there is anything else you would like to tell us, let us know!