-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test cases and remove unnecessary error
- Loading branch information
1 parent
c517e86
commit b0bbdc0
Showing
2 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,10 +50,6 @@ import ( | |
//go:embed templates | ||
var templatesFS embed.FS | ||
|
||
var ( | ||
errNoVersionFound = errors.New("no version found in the path of the source file") | ||
) | ||
|
||
type Instrument struct { | ||
realInst instrument.Instrument | ||
methodFilters []*instrument.Point | ||
|
@@ -110,7 +106,7 @@ func (i *Instrument) CouldHandle(opts *api.CompileOptions) bool { | |
} | ||
// check the version of the framework could handler | ||
version, err := i.tryToFindThePluginVersion(opts, ins) | ||
if err != nil && !errors.Is(err, errNoVersionFound) { | ||
if err != nil { | ||
logrus.Warnf("ignore the plugin %s, because %s", ins.Name(), err) | ||
continue | ||
} | ||
|
@@ -566,7 +562,10 @@ func (i *Instrument) tryToFindThePluginVersion(opts *api.CompileOptions, ins ins | |
// arg example: github.com/!shopify/[email protected]/acl.go | ||
_, afterPkg, found := strings.Cut(arg, escapedBasePkg) | ||
if !found { | ||
return "", errors.Wrapf(errNoVersionFound, "package %s, go file path: %s", basePkg, arg) | ||
// This could happen if the module is replaced by a local one | ||
// For example, in the E2E | ||
logrus.Warnf("could not found the go version of the package %s, go file path: %s", basePkg, arg) | ||
return "", nil | ||
} | ||
|
||
if !strings.HasPrefix(afterPkg, "@") { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters