Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
Merge 2394c8d into 496597b
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Mirecki committed Jun 17, 2019
2 parents 496597b + 2394c8d commit 7a6abab
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions retrodep/gosource.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,19 +533,20 @@ func (src GoSource) RepoPathForImportPath(importPath string) (*RepoPath, error)

// No replacement found, use the import pth as-is
r, err := vcs.RepoRootForImportPath(importPath, false)
if err != nil && strings.ContainsRune(importPath, '_') {
// gopkg.in gives bad responses for paths like
// gopkg.in/foo/bar.v2/_examples/chat1
// because of the underscore. Remove it and try again.
if err != nil {
u := strings.Index(importPath, "_")
if u == -1 {
return nil, err
}
// go.pkg ... it and try again.
importPath = path.Dir(importPath[:u])
r, nerr := vcs.RepoRootForImportPath(importPath, false)
if nerr == nil {
return &RepoPath{RepoRoot: *r}, nil
r, err2 := vcs.RepoRootForImportPath(importPath, false)
if err2 != nil {
return nil, err // Returning the initial error is intentional
}
return &RepoPath{RepoRoot: *r}, nil
}

return &RepoPath{RepoRoot: *r}, err
return &RepoPath{RepoRoot: *r}, nil
}

// Diff writes (to out) the differences between the Go source code at
Expand Down

0 comments on commit 7a6abab

Please sign in to comment.