Merge pull request #204 from tariq1890/master

Renaming repos directory to _repos as per issue #203 and updating travis yml
This commit is contained in:
Shawn Smith
2017-09-19 19:17:51 +09:00
committed by GitHub
5 changed files with 10 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ language: go
go:
- 1.8
- 1.9
- tip
install:

View File

@@ -216,7 +216,7 @@ func goPkgInToGitHub(name string) string {
func fileURL(dir, filename string) string {
var fileURL string
base := strings.TrimPrefix(dir, "repos/src/")
base := strings.TrimPrefix(dir, "_repos/src/")
switch {
case strings.HasPrefix(base, "golang.org/x/"):
var pkg string
@@ -263,14 +263,14 @@ func getFileSummaryMap(out *bufio.Scanner, dir string) (map[string]FileSummary,
outer:
for out.Scan() {
filename := strings.Split(out.Text(), ":")[0]
filename = strings.TrimPrefix(filename, "repos/src")
filename = strings.TrimPrefix(filename, "_repos/src")
for _, skip := range skipSuffixes {
if strings.HasSuffix(filename, skip) {
continue outer
}
}
if autoGenerated("repos/src" + filename) {
if autoGenerated("_repos/src" + filename) {
continue outer
}
@@ -391,10 +391,10 @@ func GoFmtNative(dir string, filenames []string) (float64, []FileSummary, error)
errChan <- err
}
if !bytes.Equal(b, g) {
filename := strings.TrimPrefix(f, "repos/src")
filename := strings.TrimPrefix(f, "_repos/src")
fs := FileSummary{}
fs.Filename = makeFilename(filename)
fu := fileURL(dir, strings.TrimPrefix(f, "repos/src"))
fu := fileURL(dir, strings.TrimPrefix(f, "_repos/src"))
fs.FileURL = fu
fs.Errors = append(fs.Errors, Error{1, "file is not gofmted"})

View File

@@ -15,7 +15,7 @@ import (
)
func dirName(repo string) string {
return fmt.Sprintf("repos/src/%s", repo)
return fmt.Sprintf("_repos/src/%s", repo)
}
func getFromCache(repo string) (checksResp, error) {
@@ -87,7 +87,7 @@ func newChecksResp(repo string, forceRefresh bool) (checksResp, error) {
}
// fetch the repo and grade it
repoRoot, err := download.Download(repo, "repos/src")
repoRoot, err := download.Download(repo, "_repos/src")
if err != nil {
return checksResp{}, fmt.Errorf("could not clone repo: %v", err)
}

View File

@@ -6,7 +6,7 @@ var dirNameTests = []struct {
url string
want string
}{
{"github.com/foo/bar", "repos/src/github.com/foo/bar"},
{"github.com/foo/bar", "_repos/src/github.com/foo/bar"},
}
func TestDirName(t *testing.T) {

View File

@@ -78,7 +78,7 @@ func initDB() error {
func main() {
flag.Parse()
if err := os.MkdirAll("repos/src/github.com", 0755); err != nil && !os.IsExist(err) {
if err := os.MkdirAll("_repos/src/github.com", 0755); err != nil && !os.IsExist(err) {
log.Fatal("ERROR: could not create repos dir: ", err)
}