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

help: lint tool suggestion #294

Open
ppd0705 opened this issue Sep 23, 2022 · 4 comments
Open

help: lint tool suggestion #294

ppd0705 opened this issue Sep 23, 2022 · 4 comments

Comments

@ppd0705
Copy link

ppd0705 commented Sep 23, 2022

I make a same stupid error many times. the error is like the code below

a := decimal.NewFromString("123")
b := decimal.NewFromString("345")
a.Sub(b)
// wanted:  a = a.Sub(b)

I often forget a = . is there any lint tool for this situation ?

@xiegeo
Copy link

xiegeo commented Nov 29, 2022

govet has an unusedresult check. https://golangci-lint.run/usage/linters#govet

@ppd0705
Copy link
Author

ppd0705 commented Nov 29, 2022

govet has an unusedresult check. https://golangci-lint.run/usage/linters#govet

thanks for your reply. the document is to simple to understand, do your have a config template ?
I tried the conf below, it doesn‘t work

lint:
  govet:
    settings:
      unusedresult:
        stringmethods:
          - (github.com/shopspring/decimal.Decimal).Sub

@xiegeo
Copy link

xiegeo commented Nov 30, 2022

@ppd0705 that looks like the funcs formate, stringmethods should just be Sub

lint:
  govet:
    settings:
      unusedresult:
        funcs:
          - (github.com/shopspring/decimal.Decimal).Sub
        stringmethods:
          - Sub

@ppd0705
Copy link
Author

ppd0705 commented Dec 1, 2022

@xiegeo it doesn't work either

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

No branches or pull requests

2 participants