Skip to content

fix: it didn't work correctly when the import path contains "."#6

Open
neglect-yp wants to merge 1 commit intogostaticanalysis:mainfrom
neglect-yp:fix-dot-import-path
Open

fix: it didn't work correctly when the import path contains "."#6
neglect-yp wants to merge 1 commit intogostaticanalysis:mainfrom
neglect-yp:fix-dot-import-path

Conversation

@neglect-yp
Copy link

This PR fixes that called doesn't work correctly when an import path contains ..

An import path contains . when the target function is imported from an external package. So, the format for -called.funcs should be like github.com/gostaticanalysis/pkg.Func in this case. However, the following line splits a passed function name by . to get the package name, type name and function/method name:

ss := strings.Split(strings.TrimSpace(fn), ".")

For example, github.com/gostaticanalysis/pkg.Func is split into ["github", "com/gostaticanalysis/pkg", "Func"] .

⚠️ BREAKING CHANGE

  • () is required when specifying methods in -called.funcs
    • This is the same behavior as -printf.funcs for printf analyzer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant