Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_docs: update the manual #182

Merged
merged 1 commit into from
Jan 12, 2021
Merged

_docs: update the manual #182

merged 1 commit into from
Jan 12, 2021

Conversation

quasilyte
Copy link
Owner

Refs #149

@quasilyte quasilyte merged commit 2bbed34 into master Jan 12, 2021
@quasilyte quasilyte deleted the quasilyte/docs/update_manual branch January 12, 2021 19:00
)

func implementsStringer(ctx *dsl.VarFilterContext) bool {
stringer := ctx.GetInterface(`fmt.Stringer`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth having an example where the interface name requires an import. Presumably the import does not (and cannot) be done in this function; it needs to be done in the rule right before m.Match, for every rule that uses implementsStringer

Copy link
Owner Author

@quasilyte quasilyte Jan 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GetInterface() (and GetType()) methods accept a FQN. So it can be a github.com/a/b.Type without Import. I also made Implements in DSL accept FQN; so Import is mostly needed for the brevity now.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It accepts a typeName parameter:

go-ruleguard/dsl/dsl.go

Lines 166 to 169 in c73ee1c

// A type name can be:
// - builtin type name: `error`, `string`, etc.
// - qualified name from a standard library: `io.Reader`, etc.
// - fully-qualified type name, like `github.com/username/pkgname.TypeName`

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.

2 participants