Simplify bytes.NewBuffer roundtrip
Recipe ID
org.openrewrite.golang.codequality.SimplifyBytesBufferRoundtripArtifactgithub.com/moderneinc/recipes-goReplace bytes.NewBuffer(b).Bytes() with b since wrapping a byte slice in a buffer only to extract it is a no-op.
Single recipeProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.golang.codequality.SimplifyBytesBufferRoundtripIf the recipe isn’t available locally, install it with:
mod config recipes go install github.com/moderneinc/recipes-go