digitalocean / digitalocean/gta

Panic in gta for ImportPath "."

Open
#19 11 comments 0 reactions 1 assignee Claimed by @bhcleek View on GitHub
Dominant language
Go
Stars
224
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Hi,

Thanks for creating this project!

Unfortunately with the recent changes to optimise gta processing speed, we've come across a panic whilst running gta on one of our repos. I'm afraid I'm not allowed to share the repo.

The error output is:
```go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x606721]

goroutine 1 [running]:
github.com/digitalocean/gta.(*GTA).ChangedPackages(0xc0000c3310, 0x3, 0x4, 0xc0000c3310)
/root/gta/gta.go:187 +0x201
main.main()
/root/gta/cmd/gta/main.go:80 +0x6ef
r
```

I have tracked the issue down to:
* Change in commit: https://github.com/digitalocean/gta/commit/d5dac295d3625c15402e57fbd35f32fc0b0f7c2b
* Actual error is: `no buildable Go source files in .`
* The error is not trapped through any error detection and eventually panics in https://github.com/digitalocean/gta/blob/master/gta.go#L193 when a call to pkg.ImportPath is made but pkg is nil.
* Specifically:
```go
if _, ok := p.forward[importPath]; !ok {
// TODO(bc): importPath is probably _not_ the right thing to use for Dir. So what _is_?
return nil, &build.NoGoError{Dir: importPath}
}
```
* Path `.` is not in the p.forward list

I'm afraid I'm not sure why there is `.` in the p.forward map.

Any help would be gratefully received!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.