diff --git a/package.go b/package.go index f861677..2e15c26 100644 --- a/package.go +++ b/package.go @@ -219,17 +219,7 @@ func (c *PathPackageClassifier) Classify(pkg *Package) PackageClass { // Otherwise, false is retuned. func IsStandardLibrary(pkg string) bool { _, ok := stdPkgs[pkg] - if ok { - return true - } - - // Detect regexp.(*onePassInst).regexp/syntax type packages - tmp := strings.Split(pkg, ".")[0] - if len(tmp) < len(pkg) && IsStandardLibrary(tmp) { - return true - } - - return false + return ok } func isGeneratedPackage(pkg *Package) bool { diff --git a/package_test.go b/package_test.go index e9f49f8..fd152c6 100644 --- a/package_test.go +++ b/package_test.go @@ -59,21 +59,13 @@ func TestClassifyPackage(t *testing.T) { {"crypto/sha512", "C:/Go/src/crypto/sha512", ClassSTD}, {"crypto/subtle", "C:/Go/src/crypto/subtle", ClassSTD}, {"crypto/tls", "C:/Go/src/crypto/tls", ClassSTD}, - {"crypto/tls.(*Config).(crypto/tls", "C:/Go/src/crypto/tls", ClassSTD}, {"crypto/x509", "C:/Go/src/crypto/x509", ClassSTD}, {"crypto/x509/pkix", "C:/Go/src/crypto/x509/pkix", ClassSTD}, {"encoding/asn1", "C:/Go/src/encoding/asn1", ClassSTD}, {"encoding/base64", "C:/Go/src/encoding/base64", ClassSTD}, {"encoding/binary", "C:/Go/src/encoding/binary", ClassSTD}, {"encoding/hex", "C:/Go/src/encoding/hex", ClassSTD}, - {"encoding/json.(*arrayEncoder).(encoding/json", "C:/Go/src/encoding/json", ClassSTD}, {"encoding/json", "C:/Go/src/encoding/json", ClassSTD}, - {"encoding/json.(*condAddrEncoder).(encoding/json", "C:/Go/src/encoding/json", ClassSTD}, - {"encoding/json.(floatEncoder).(encoding/json", "C:/Go/src/encoding/json", ClassSTD}, - {"encoding/json.(*mapEncoder).(encoding/json", "C:/Go/src/encoding/json", ClassSTD}, - {"encoding/json.(*ptrEncoder).(encoding/json", "C:/Go/src/encoding/json", ClassSTD}, - {"encoding/json.(*sliceEncoder).(encoding/json", "C:/Go/src/encoding/json", ClassSTD}, - {"encoding/json.(*structEncoder).(encoding/json", "C:/Go/src/encoding/json", ClassSTD}, {"encoding/pem", "C:/Go/src/encoding/pem", ClassSTD}, {"errors", "C:/Go/src/errors", ClassSTD}, {"fmt", "C:/Go/src/fmt", ClassSTD}, @@ -98,11 +90,6 @@ func TestClassifyPackage(t *testing.T) { {"golang.org/x/crypto/ssh", "C:/Users/h/CloudStation/Projects/0/ly/lady/vendor/src/golang.org/x/crypto/ssh", ClassVendor}, {"golang.org/x/net/publicsuffix", "C:/Users/h/CloudStation/Projects/0/ly/lady/vendor/src/golang.org/x/net/publicsuffix", ClassVendor}, {"gopkg.in/vmihailenco/msgpack%2ev2", "C:/Users/h/CloudStation/Projects/0/ly/lady/vendor/src/gopkg.in/vmihailenco/msgpack.v2", ClassVendor}, - {"go.(*struct { net/http", ".", ClassSTD}, - {"go.struct { net/http", ".", ClassSTD}, - {"go.(*struct { sync.Mutex; table [64]math/big", ".", ClassSTD}, - {"go.(*struct { sync.RWMutex; m map[reflect.Type][]encoding/json", ".", ClassSTD}, - {"go.(*struct { sync.RWMutex; m map[reflect.Type]encoding/json", ".", ClassSTD}, {"hash", "C:/Go/src/hash", ClassSTD}, {"hash/crc32", "C:/Go/src/hash/crc32", ClassSTD}, {"internal/golang.org/x/net/http2/hpack", "C:/Go/src/internal/golang.org/x/net/http2/hpack", ClassSTD}, @@ -122,31 +109,18 @@ func TestClassifyPackage(t *testing.T) { {"net", "C:/Go/src/runtime", ClassSTD}, {"net/http", "C:/Go/src/net/http", ClassSTD}, {"net/http/cookiejar", "C:/Go/src/net/http/cookiejar", ClassSTD}, - {"net/http.(*envOnce).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*http2clientConnReadLoop).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*http2clientStream).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*http2responseWriterState).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*http2serverConn).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*http2stream).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*http2Transport).(net/http", "C:/Go/src/net/http", ClassSTD}, {"net/http/httputil", "C:/Go/src/net/http/httputil", ClassSTD}, {"net/http/internal", "C:/Go/src/net/http/internal", ClassSTD}, - {"net/http.(*persistConn).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*response).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*Server).(net/http", "C:/Go/src/net/http", ClassSTD}, - {"net/http.(*Transport).(net/http", "C:/Go/src/net/http", ClassSTD}, {"net/textproto", "C:/Go/src/net/textproto", ClassSTD}, {"net/url", "C:/Go/src/net/url", ClassSTD}, {"os", "C:/Go/src/runtime", ClassSTD}, {"os/exec", "C:/Go/src/os/exec", ClassSTD}, - {"os/exec.(*closeOnce).(os/exec", "C:/Go/src/os/exec", ClassSTD}, {"os/user", "C:/Go/src/os/user", ClassSTD}, {"path", "C:/Go/src/path", ClassSTD}, {"path/filepath", "C:/Go/src/path/filepath", ClassSTD}, {"redis", "C:/Users/h/CloudStation/Projects/0/ly/lady/src/redis", ClassMain}, {"reflect", "C:/Go/src/runtime", ClassSTD}, {"regexp", "C:/Go/src/regexp", ClassSTD}, - {"regexp.(*onePassInst).regexp/syntax", ".", ClassSTD}, {"regexp/syntax", "C:/Go/src/regexp/syntax", ClassSTD}, {"runtime", "C:/Go/src/runtime", ClassSTD}, {"runtime/debug", "C:/Go/src/runtime", ClassSTD}, @@ -160,8 +134,6 @@ func TestClassifyPackage(t *testing.T) { {"syscall", "C:/Go/src/runtime", ClassSTD}, {"text/template", "C:/Go/src/text/template", ClassSTD}, {"text/template/parse", "C:/Go/src/text/template/parse", ClassSTD}, - {"text/template.(*Template).text/template/parse", ".", ClassSTD}, - {"text/template.Template.text/template/parse", ".", ClassSTD}, {"time", "C:/Go/src/runtime", ClassSTD}, {"type", "C:/Users/h/CloudStation/Projects/0/ly/lady/src/lady", ClassGenerated}, {"type..eq.[0]github.com/shirou/gopsutil/net", "C:/Users/h/CloudStation/Projects/0/ly/lady/vendor/src/github.com/shirou/gopsutil/net", ClassGenerated},