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

*: Remove nil check from setters #388

Merged
merged 1 commit into from
Mar 31, 2022
Merged

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Mar 23, 2022

Close #388 .

I knew one day sed would save me an hour of manual work:

sed -i -n -e '
s/) Set/) Set/
p
t setter
b end
:setter
    n
    s/nil/nil/
    t hasif
    p
    b end
    :hasif
        n
        :loop
        p
        n
        s/}/}/
        t end
        b loop
        :end
' $@
goimports -w $@

Signed-off-by: Evgenii Stratonikov evgeniy@nspcc.ru

@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #388 (3869910) into master (5016274) will decrease coverage by 1.06%.
The diff coverage is 96.77%.

❗ Current head 3869910 differs from pull request most recent head 825af89. Consider uploading reports for the commit 825af89 to get more accurate results

@@            Coverage Diff             @@
##           master     #388      +/-   ##
==========================================
- Coverage   61.97%   60.91%   -1.07%     
==========================================
  Files          71       71              
  Lines       10239     9934     -305     
==========================================
- Hits         6346     6051     -295     
+ Misses       2939     2929      -10     
  Partials      954      954              
Impacted Files Coverage Δ
session/util.go 25.71% <0.00%> (+1.38%) ⬆️
netmap/types.go 32.64% <91.66%> (-7.65%) ⬇️
acl/types.go 31.74% <95.23%> (-9.08%) ⬇️
container/types.go 33.84% <97.91%> (-8.98%) ⬇️
session/types.go 31.78% <97.95%> (-9.24%) ⬇️
accounting/accounting.go 33.33% <100.00%> (-9.53%) ⬇️
audit/types.go 33.33% <100.00%> (-9.53%) ⬇️
object/types.go 36.58% <100.00%> (-8.92%) ⬇️
refs/types.go 47.25% <100.00%> (-6.60%) ⬇️
reputation/types.go 33.33% <100.00%> (-9.53%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5016274...825af89. Read the comment docs.

carpawell
carpawell previously approved these changes Mar 29, 2022
Copy link
Member

@carpawell carpawell left a comment

Choose a reason for hiding this comment

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

I would add issue number to the commit

I knew one day `sed` would save me an hour of manual work:
```
sed -i -n -e '
s/) Set/) Set/
p
t setter
b end
:setter
    n
    s/nil/nil/
    t hasif
    p
    b end
    :hasif
        n
        :loop
        p
        n
        s/}/}/
        t end
        b loop
        :end
' $@
goimports -w $@
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
@alexvanin alexvanin merged commit 732dd51 into nspcc-dev:master Mar 31, 2022
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.

Remove nil condition from field setters
3 participants