Skip to content

Commit

Permalink
Merge pull request #93 from Zxilly/classifier
Browse files Browse the repository at this point in the history
fix: remove invalid mod test
  • Loading branch information
TcM1911 authored Oct 8, 2024
2 parents 37ff1be + 37f37cc commit 8475be9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
12 changes: 1 addition & 11 deletions package.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
28 changes: 0 additions & 28 deletions package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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},
Expand All @@ -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},
Expand All @@ -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},
Expand Down

0 comments on commit 8475be9

Please sign in to comment.