blizzy78 / varnamelen

Go analyzer checking that the length of a variable's name matches its usage scope
MIT License
20 stars 2 forks source link

too short variables in constuctor #22

Closed maranqz closed 1 year ago

maranqz commented 1 year ago

Hello. My structure initializing in constructor with options is marked as "too short".

What do you think about option to skip this case.

struct st {
  p1 bool
  p2 bool
  ....
}

type Option func(*st)

func New() st {
   s := st{
     // set default values
   }

   for _, o := range oo {
      o(&s)
   }

   return s
}
blizzy78 commented 1 year ago

In this case, a comment //nolint:varnamelen should be used.