Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
Do not block vendored packages
Browse files Browse the repository at this point in the history
Fixes #195
  • Loading branch information
garyburd committed Jan 20, 2015
1 parent 465d52d commit f38af64
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions gddo-server/crawl.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,13 @@ package main

import (
"log"
"regexp"
"strings"
"time"

"github.com/golang/gddo/doc"
"github.com/golang/gddo/gosrc"
)

var nestedProjectPat = regexp.MustCompile(`/(?:github\.com|launchpad\.net|code\.google\.com/p|bitbucket\.org|labix\.org)/`)

func exists(path string) bool {
b, err := db.Exists(path)
if err != nil {
b = false
}
return b
}

// crawlDoc fetches the package documentation from the VCS and updates the database.
func crawlDoc(source string, importPath string, pdoc *doc.Package, hasSubdirs bool, nextCrawl time.Time) (*doc.Package, error) {
message := []interface{}{source}
Expand Down Expand Up @@ -61,9 +50,6 @@ func crawlDoc(source string, importPath string, pdoc *doc.Package, hasSubdirs bo
// Old import path for Go sub-repository.
pdoc = nil
err = gosrc.NotFoundError{Message: "old Go sub-repo", Redirect: "golang.org/x/" + importPath[len("code.google.com/p/go."):]}
} else if m := nestedProjectPat.FindStringIndex(importPath); m != nil && exists(importPath[m[0]+1:]) {
pdoc = nil
err = gosrc.NotFoundError{Message: "copy of other project."}
} else if blocked, e := db.IsBlocked(importPath); blocked && e == nil {
pdoc = nil
err = gosrc.NotFoundError{Message: "blocked."}
Expand Down

0 comments on commit f38af64

Please sign in to comment.