catenacyber / perfsprint

Golang linter to use strconv
MIT License
19 stars 2 forks source link

Configuration support (good first issue) #7

Closed Antonboom closed 9 months ago

Antonboom commented 9 months ago

Just so we don't forget the idea :)

What (DRAFT):

perfsprint:
  enabled:
    - string    # Just using string
    - error     # Just using Error()
    - bool      # strconv.FormatBool
    - hex       # hex.EncodeToString
    - int       # strconv.Itoa or strconv.FormatInt
    - uint      # strconv.FormatUint
  int:
      # Enable int and int64 only mode
      no-type-conversions: true
  uint:
      # Enable uint64 only mode
      no-type-conversions: true

How to: https://github.com/catenacyber/perfsprint/pull/1#discussion_r1364375733

catenacyber commented 9 months ago

What do you think of https://github.com/catenacyber/perfsprint/commit/e95837062d16c387050fc9a45fbe0b536a3ec90b ?

Antonboom commented 9 months ago

@catenacyber, very pretty and accurate solution

Proposals

1)

optimizes even if it needs an int conversion

->

optimizes even if it requires an int or uint type cast

2)

Reflect new flag in README#Usage

catenacyber commented 9 months ago

Done

Is this good for you ? Should I do a 0.3 tag release and make a PR to golangci-lint to use this ?

Antonboom commented 9 months ago

Should I do a 0.3 tag release and make a PR to golangci-lint to use this ?

yes, but better v0.2.1

Is this good for you ?

feel free to close any of my issues