Issue running the example_test.go

Labels: area/test kind/bug lifecycle/stale priority/awaiting-more-evidence

Timeline

Helena (hexylena) opened

Hi y'all, I'm really excited to try using git-bug as a backend for a personal project, but I'm getting a bit stuck on how the operations should work.

I've tried both v0.8.0 and master but both fail to unmarshal the identity in the operation. (I've copied the example_test.go to my own project, set the package to main, and renamed the test function to main as well. go get github.com/MichaelMure/git-bug/entity was run to fetch the deps)

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb3db9c]

goroutine 1 [running]:
main.main()
        /home/user/arbeit/emc/projects/testing/example.go:338 +0x89c
exit status 2

Adding some debugging in relevant places makes it clear

diff --git a/example.go b/example.go
index 3899be1..15c3c15 100644
--- a/example.go
+++ b/example.go
@@ -328,11 +328,20 @@ func main() {
        confRene.Append(NewSetSignatureRequired(rene, true))
 
        // Rene commits on its own repo
-       _ = confRene.Commit(repoRene)
+       err := confRene.Commit(repoRene)
+       if err != nil {
+               panic(err)
+       }
 
        // Isaac pull and read the config
-       _ = dag.Pull(def, wrapper, repoIsaac, simpleResolvers(repoIsaac), "origin", isaac)
-       confIsaac, _ := Read(repoIsaac, confRene.Id())
+       err = dag.Pull(def, wrapper, repoIsaac, simpleResolvers(repoIsaac), "origin", isaac)
+       if err != nil {
+               panic(err)
+       }
+       confIsaac, err := Read(repoIsaac, confRene.Id())
+       if err != nil {
+               panic(err)
+       }
 
        // Compile gives the current state of the config

with the error:

panic: merge failure: remote project config is not readable: json: cannot unmarshal object into Go struct field AddAdministrator.to_add of type identity.Interface

goroutine 1 [running]:
main.main()
        /home/user/arbeit/emc/projects/testing/example.go:339 +0xc28
exit status 2

it seems like this is possibly due to https://github.com/MichaelMure/git-bug/blob/3297223022630bd3aac2d119ae0870c995a7da2e/entities/identity/identity.go#L85

Any suggestions or would it be possible that this example could be updated to function again?

sudoforge added label kind/bug

sudoforge added label area/identity

sudoforge added label lifecycle/active

sudoforge added label priority/awaiting-more-evidence

sudoforge removed label area/identity

sudoforge added label area/test

sudoforge commented

Hey @hexylena, thanks for bringing this up. I'm sorry that you're encountering an issue with the example DAG test. This is not an area of the codebase that I'm yet intimately familiar with, but I'll follow the information you provided in order to attempt to reproduce this.

github-actions (github-actions) commented

This bot triages issues in order to help the maintainers identify what needs attention, according to the following lifecycle rules:

  • After 90 days of inactivity, lifecycle/stale is applied
  • After 90 days of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied

This bot will not automatically close stale issues.

To remove the stale status, you can:

  • Remove the stale label from this issue
  • Comment on this issue
  • Close this issue
  • Offer to help out with triaging

To avoid automatic lifecycle management of this issue, add lifecycle/frozen.

github-actions (github-actions) added label lifecycle/stale

github-actions (github-actions) removed label lifecycle/active

github-actions (github-actions) commented

Pinging maintainers. This issue has been inactive for 90 days.
Issues will not be automatically closed due to inactivity.


Learn more

This bot triages issues in order to help the maintainers identify what needs attention, according to the following lifecycle rules:

  • After 90 days of inactivity, lifecycle/idle is applied
  • After 180 days of inactivity, lifecycle/dormant is applied

The following actions remove the inactive status:

  • Removing the lifecycle/* label from this issue
  • Commenting on this issue
  • Adding a new assignee to this issue
  • Reopening this issue
  • Adding this issue to a milestone
  • Pinning this issue to the top of the issue board

To avoid automatic lifecycle management of this issue, maintainers can add the lifecycle/pinned label.

github-actions (github-actions) added label lifecycle/idle

sudoforge removed label lifecycle/idle-auto

sudoforge removed label lifecycle/idle