How to: [⏫](#contents) :gift: Detect performance optimizations with [perfsprint](https://github.com/catenacyber/perfsprint)
This tool detects possible performance optimizations in source code. It suggests replacing usages of `fmt.Sprintf` and `fmt.Errorf` with more efficient alternatives. — [@catenacyber](https://github.com/catenacyber)

```
perfsprint .
```

```go
package main

import (
  "fmt"
)

var _ = fmt.Errorf("some error")

func Sprintf() {
  _ = fmt.Sprintf("Hello, World!")
  world := "World"
  _ = fmt.Sprintf("Hello %s", world)
  _ = fmt.Sprintf("%d", 42)
  _ = fmt.Sprintf("%d", int64(42))
}
```

Example
```
/testdata/perfsprint.go:7:9: error-format: fmt.Errorf can be replaced with errors.New
/testdata/perfsprint.go:10:6: string-format: fmt.Sprintf can be replaced with just using the string
/testdata/perfsprint.go:12:6: string-format: fmt.Sprintf can be replaced with string concatenation
/testdata/perfsprint.go:13:6: integer-format: fmt.Sprintf can be replaced with faster strconv.Itoa
/testdata/perfsprint.go:14:6: integer-format: fmt.Sprintf can be replaced with faster strconv.FormatInt
/testdata/perfsprint.go:4:2: fiximports: Fix imports
```

Requirements
```
go install github.com/catenacyber/perfsprint@latest
```