github.com/sdboyer/gps@v0.16.3/internal/internal.go (about)

     1  // Package internal provides support for gps own packages.
     2  package internal
     3  
     4  import "strings"
     5  
     6  // IsStdLib is a reference to internal implementation.
     7  // It is stored as a var so that tests can swap it out. Ugh globals, ugh.
     8  var IsStdLib = doIsStdLib
     9  
    10  // This was lovingly lifted from src/cmd/go/pkg.go in Go's code
    11  // (isStandardImportPath).
    12  func doIsStdLib(path string) bool {
    13  	i := strings.Index(path, "/")
    14  	if i < 0 {
    15  		i = len(path)
    16  	}
    17  
    18  	return !strings.Contains(path[:i], ".")
    19  }