gopkg.in/alecthomas/gometalinter.v3@v3.0.0/_linters/src/github.com/kisielk/gotool/internal/load/pkg.go (about)

     1  // Copyright 2011 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  // +build go1.9
     6  
     7  // Package load loads packages.
     8  package load
     9  
    10  import (
    11  	"strings"
    12  )
    13  
    14  // isStandardImportPath reports whether $GOROOT/src/path should be considered
    15  // part of the standard distribution. For historical reasons we allow people to add
    16  // their own code to $GOROOT instead of using $GOPATH, but we assume that
    17  // code will start with a domain name (dot in the first element).
    18  func isStandardImportPath(path string) bool {
    19  	i := strings.Index(path, "/")
    20  	if i < 0 {
    21  		i = len(path)
    22  	}
    23  	elem := path[:i]
    24  	return !strings.Contains(elem, ".")
    25  }