Skip to content

Commit

Permalink
fix: revert some unneed modification
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxilly committed Jan 29, 2024
1 parent eadc531 commit b228205
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions package.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ func (c *PathPackageClassifier) Classify(pkg *Package) PackageClass {
}

// Detect internal/golang.org/x/net/http2/hpack type/
tmp := strings.Split(pkg.Name, "golang.org")[0]
tmp = strings.TrimRight(tmp, "/\\")
tmp := strings.Split(pkg.Name, "/golang.org")[0]
if len(tmp) < len(pkg.Name) && IsStandardLibrary(tmp) {
return ClassSTD
}
Expand Down
20 changes: 10 additions & 10 deletions package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TestClassifyPackage(t *testing.T) {
{"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", "<autogenerated>", ClassGenerated},
{"regexp.(*onePassInst).regexp/syntax", ".", ClassGenerated},
{"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 +160,8 @@ 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", "<autogenerated>", ClassGenerated},
{"text/template.Template.text/template/parse", "<autogenerated>", ClassGenerated},
{"text/template.(*Template).text/template/parse", ".", ClassGenerated},
{"text/template.Template.text/template/parse", ".", ClassGenerated},
{"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 Expand Up @@ -318,7 +318,7 @@ func TestClassifyPackage(t *testing.T) {
{"vendor/golang_org/x/crypto/curve25519", "c:/go/src/vendor/golang_org/x/crypto/curve25519", ClassVendor},
{"github.com/kbinani/screenshot", "c:/go/src/github.com/kbinani/screenshot", ClassVendor},
{"github.com/go-ole/go-ole/oleutil", "c:/go/src/github.com/go-ole/go-ole/oleutil", ClassVendor},
{"github.com/shirou/gopsutil/net", "<autogenerated>", ClassUnknown},
{"github.com/shirou/gopsutil/net", ".", ClassUnknown},
{"github.com/iamacarpet/go-win64api", "c:/go/src/github.com/iamacarpet/go-win64api", ClassVendor},
{"github.com/kbinani/screenshot/internal/util", "c:/go/src/github.com/kbinani/screenshot/internal/util", ClassVendor},
{"golang.org/x/sys/windows/svc", "c:/go/src/golang.org/x/sys/windows/svc", ClassVendor},
Expand All @@ -335,9 +335,9 @@ func TestClassifyPackage(t *testing.T) {
{"vendor/golang_org/x/crypto/cryptobyte", "c:/go/src/vendor/golang_org/x/crypto/cryptobyte", ClassVendor},
{"vendor/golang_org/x/crypto/chacha20poly1305", "c:/go/src/vendor/golang_org/x/crypto/chacha20poly1305", ClassVendor},
{"golang.org/x/sys/windows/registry", "c:/go/src/golang.org/x/sys/windows/registry", ClassVendor},
{"vendor/golang_org/x/text/transform", "<autogenerated>", ClassVendor},
{"golang.org/x/sys/windows/svc/mgr", "<autogenerated>", ClassUnknown},
{"github.com/shirou/gopsutil/mem", "<autogenerated>", ClassUnknown},
{"vendor/golang_org/x/text/transform", ".", ClassVendor},
{"golang.org/x/sys/windows/svc/mgr", ".", ClassUnknown},
{"github.com/shirou/gopsutil/mem", ".", ClassUnknown},
{"github.com/shirou/gopsutil/process", "c:/go/src/github.com/shirou/gopsutil/process", ClassVendor},
{"github.com/iamacarpet/go-win64api/shared", "c:/go/src/github.com/iamacarpet/go-win64api/shared", ClassVendor},
{"vendor/golang_org/x/net/http/httpproxy", "c:/go/src/vendor/golang_org/x/net/http/httpproxy", ClassVendor},
Expand Down Expand Up @@ -459,9 +459,9 @@ func TestCommandLineArgumentsPagkageDetection(t *testing.T) {
pkgPath string
pkgClass PackageClass
}{
{"x_cgo_sys_thread_creater", "<autogenerated>", ClassSTD},
{"_cgo_sys_thread_star", "<autogenerated>", ClassSTD},
{"", "<autogenerated>", ClassGenerated},
{"x_cgo_sys_thread_creater", ".", ClassSTD},
{"_cgo_sys_thread_star", ".", ClassSTD},
{"", ".", ClassGenerated},
{"gopackage", "gopackage", ClassMain},
{"gopackage/subpackage", "gopackage/subpackage", ClassMain},
}
Expand Down

0 comments on commit b228205

Please sign in to comment.