From 5c13744658899a5dcb4823d2aefa036244bc55bc Mon Sep 17 00:00:00 2001 From: xushiwei Date: Mon, 22 Jan 2024 12:25:06 +0800 Subject: [PATCH] gopmod: IsPkgtStandard --- gopmod/module.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gopmod/module.go b/gopmod/module.go index 9faf8a2..88e622e 100644 --- a/gopmod/module.go +++ b/gopmod/module.go @@ -56,6 +56,11 @@ const ( PkgtInvalid = -1 // an invalid package ) +// IsPkgtStandard checks if a pkgPath is Go standard package or not. +func (p *Module) IsPkgtStandard(pkgPath string) bool { + return p.PkgType(pkgPath) == PkgtStandard +} + // PkgType returns the package type of specified package. func (p *Module) PkgType(pkgPath string) PkgType { if pkgPath == "" {