Skip to content

Enhancing RepositoryContent Struct for SubmoduleGitURL support in github/repos_contents.go #2877

@ArisBee

Description

@ArisBee

Hello,

A few weeks ago, I came across an issue while running a project built atop go-github. My goal was to iterate over a GitHub Submodule folder, but it became evident that go-github might need to parse more elements from the GitHub API.

I've made an attempt to adjust this, but unfortunately, it didn't work. Here are the error logs:

allstar-756f9ccdb9-c9pzl allstar panic: runtime error: invalid memory address or nil pointer dereference                                                                                                                                                    │
│ allstar-756f9ccdb9-c9pzl allstar [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x8220f8]                                                                                                                                                    │
│ allstar-756f9ccdb9-c9pzl allstar                                                                                                                                                                                                                            │
│ allstar-756f9ccdb9-c9pzl allstar goroutine 52 [running]:                                                                                                                                                                                                    │
│ allstar-756f9ccdb9-c9pzl allstar github.com/catawiki/go-github/v50/github.(*RepositoryContent).GetContent(0xc000a7b9b0?)                                                                                                                                    │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/go/pkg/mod/github.com/catawiki/go-github/v50@v50.0.0-20230811121342-0605ae2cb9e3/github/repos_contents.go:76 +0x18                                                                                        │
│ allstar-756f9ccdb9-c9pzl allstar github.com/ossf/allstar/pkg/config.fetchConfig({0x1a79890, 0xc0006e45a0}, {0x1a731a0, 0xc000305310}, {0xc0002ec7f1, 0xd}, {0xc0002ec7b8, 0x8}, {0x16d135a, 0xc}, ...)                                                      │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/allstar/pkg/config/config.go:206 +0x331                                                                                                                                                                   │
│ allstar-756f9ccdb9-c9pzl allstar github.com/ossf/allstar/pkg/config.getAppConfigs({0x1a79890, 0xc0006e45a0}, {0x1a731a0, 0xc000305310}, {0xc0002ec7f1, 0xd}, {0xc0002ec7b8, 0x8})                                                                           │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/allstar/pkg/config/config.go:394 +0x3ed                                                                                                                                                                   │
│ allstar-756f9ccdb9-c9pzl allstar github.com/ossf/allstar/pkg/config.isBotEnabled({0x1a79890, 0xc0006e45a0}, {0x1a731a0, 0xc000305310}, {0xc0002ec7f1, 0xd}, {0xc0002ec7b8, 0x8})                                                                            │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/allstar/pkg/config/config.go:343 +0x6b                                                                                                                                                                    │
│ allstar-756f9ccdb9-c9pzl allstar github.com/ossf/allstar/pkg/config.IsBotEnabled({0x1a79890?, 0xc0006e45a0?}, 0x16d06b3?, {0xc0002ec7f1?, 0xc00028ca00?}, {0xc0002ec7b8?, 0xd?})                                                                            │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/allstar/pkg/config/config.go:339 +0x4a                                                                                                                                                                    │
│ allstar-756f9ccdb9-c9pzl allstar github.com/ossf/allstar/pkg/enforce.runPoliciesOnInstRepos({0x1a79890, 0xc0006e45a0}, {0xc0005481c0, 0x7, 0x3?}, 0xc000132180?, {0x0, 0x0})                                                                                │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/allstar/pkg/enforce/enforce.go:188 +0x112                                                                                                                                                                 │
│ allstar-756f9ccdb9-c9pzl allstar github.com/ossf/allstar/pkg/enforce.EnforceAll.func1()                                                                                                                                                                     │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/allstar/pkg/enforce/enforce.go:149 +0x1b7                                                                                                                                                                 │
│ allstar-756f9ccdb9-c9pzl allstar golang.org/x/sync/errgroup.(*Group).Go.func1()                                                                                                                                                                             │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/go/pkg/mod/golang.org/x/sync@v0.2.0/errgroup/errgroup.go:75 +0x64                                                                                                                                         │
│ allstar-756f9ccdb9-c9pzl allstar created by golang.org/x/sync/errgroup.(*Group).Go                                                                                                                                                                          │
│ allstar-756f9ccdb9-c9pzl allstar     /home/user/go/pkg/mod/golang.org/x/sync@v0.2.0/errgroup/errgroup.go:72 +0xa5       

Since I've never coded in Go before, there's a chance I might have missed something essential on my working branch. Do you perhaps have insights or suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions