github.com/golang/dep@v0.5.4/gps/paths/paths.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package paths 6 7 import "strings" 8 9 // IsStandardImportPath reports whether $GOROOT/src/path should be considered 10 // part of the standard distribution. For historical reasons we allow people to add 11 // their own code to $GOROOT instead of using $GOPATH, but we assume that 12 // code will start with a domain name (dot in the first element). 13 // This was lovingly taken from src/cmd/go/pkg.go in Go's code (isStandardImportPath). 14 func IsStandardImportPath(path string) bool { 15 i := strings.Index(path, "/") 16 if i < 0 { 17 i = len(path) 18 } 19 20 return !strings.Contains(path[:i], ".") 21 }