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

add global property for Var #370

Merged
merged 17 commits into from
Feb 2, 2022
Merged

add global property for Var #370

merged 17 commits into from
Feb 2, 2022

Conversation

peakle
Copy link
Contributor

@peakle peakle commented Jan 24, 2022

No description provided.

dsl/dsl.go Outdated Show resolved Hide resolved
var globalVar2 string = time.Now().String() // want `\Qglobal var`
var globalVar3 = time.Now().String() // want `\Qglobal var`
var _ = time.Now().String() // false negative // TODO https://github.com/quasilyte/go-ruleguard/issues/369
var _ string = time.Now().String() // false negative // TODO https://github.com/quasilyte/go-ruleguard/issues/369
Copy link
Owner

Choose a reason for hiding this comment

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

I think all _ share the same "object" (none, nil object).
So they define "nothing".
Since you basically should use this IsGlobal not for a declaration but rather for the usage of some variable, I don't think these cases matter here.

Copy link
Owner

Choose a reason for hiding this comment

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

We can't have different types for nil object either. Simply because there is nothing to associate a type with.

@quasilyte
Copy link
Owner

The code is good.
Now the plan is to send the dsl package changes separately.
Then we can use this updated dsl version in this PR without mod replace hacks.

@quasilyte
Copy link
Owner

The new dsl version is dsl/v0.3.16.
When updated, a replace directive in go.mod can be removed.

@quasilyte quasilyte merged commit cb19258 into quasilyte:master Feb 2, 2022
@peakle peakle deleted the globalVar branch February 2, 2022 14:32
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