| 1 | // Copyright 2023 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Package simplifyslice defines an Analyzer that simplifies slice statements. |
| 6 | // https://github.com/golang/go/blob/master/src/cmd/gofmt/simplify.go |
| 7 | // https://golang.org/cmd/gofmt/#hdr-The_simplify_command |
| 8 | // |
| 9 | // # Analyzer simplifyslice |
| 10 | // |
| 11 | // simplifyslice: check for slice simplifications |
| 12 | // |
| 13 | // A slice expression of the form: |
| 14 | // |
| 15 | // s[a:len(s)] |
| 16 | // |
| 17 | // will be simplified to: |
| 18 | // |
| 19 | // s[a:] |
| 20 | // |
| 21 | // This is one of the simplifications that "gofmt -s" applies. |
| 22 | // |
| 23 | // This analyzer ignores generated code. |
| 24 | package simplifyslice |