go-jira
go-jira copied to clipboard
nil pointer exception for custom field not defined
Describe the bug
When setting up a project with custom fields, getting a field with Unknowns generate nil pointer exception if the custom field is not defined in JIRA
To Reproduce
- Create a custom field in JIRA of type "number"
- Do not configure it on one ticket
- Get the value
v, err := issue.Fields.Unknowns.MarshalMap(fmt.Sprintf("customfield_%d", fieldID))
Expected behavior
The value is correctly returned
Possible Solution
I will create a PR as I have found the root cause
Your Environment
Include as many relevant details about the environment you experienced the problem in
- go-jira version (git tag or sha): v1.12.0
- Go version (
go version
): 1.14 - Jira version: v8.12.0
- Jira type (cloud or on-premise): on-premise
- Involved Jira plugins: no
- Operating System and version: MAC OS X
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.
Sorry, wrong project, the problem is located in https://github.com/trivago/tgo/blob/master/tcontainer/marshalmap.go
Thanks, @jorijinnall. We might be able to fix this via a PR upstream. Let's keep this issue open because it might affect go-jira users as well.
Hi, I know it's been a while since this issue was opened. I am having the same problem. We have a few Jira Boards and not all of them have a specific custom field and there is no way to make the difference between an empty custom field VS non-existing custom field. It could be nice to be able to handle that case in go-jira. Is there some sort of work in progress about this issue? I haven't doved in tcontainer
code yet but I would be glad to contribute to this issue. Is there anything I should know beforehand?
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!