forked from golang/dep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request sdboyer/gps#189 from narqo/extract-package-tree
Extract PackageTree and stuff into subpackage
- Loading branch information
Showing
24 changed files
with
531 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Package internal provides support for gps own packages. | ||
package internal | ||
|
||
import "strings" | ||
|
||
// IsStdLib is a reference to internal implementation. | ||
// It is stored as a var so that tests can swap it out. Ugh globals, ugh. | ||
var IsStdLib = doIsStdLib | ||
|
||
// This was lovingly lifted from src/cmd/go/pkg.go in Go's code | ||
// (isStandardImportPath). | ||
func doIsStdLib(path string) bool { | ||
i := strings.Index(path, "/") | ||
if i < 0 { | ||
i = len(path) | ||
} | ||
|
||
return !strings.Contains(path[:i], ".") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package internal | ||
|
||
import "testing" | ||
|
||
func TestIsStdLib(t *testing.T) { | ||
fix := []struct { | ||
ip string | ||
is bool | ||
}{ | ||
{"appengine", true}, | ||
{"net/http", true}, | ||
{"github.com/anything", false}, | ||
{"foo", true}, | ||
} | ||
|
||
for _, f := range fix { | ||
r := doIsStdLib(f.ip) | ||
if r != f.is { | ||
if r { | ||
t.Errorf("%s was marked stdlib but should not have been", f.ip) | ||
} else { | ||
t.Errorf("%s was not marked stdlib but should have been", f.ip) | ||
|
||
} | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.