pulumi/pkg/codegen/hcl2/syntax
Abhinav Gupta e845ddf4c4
gosimple: Simplify loops
This replaces for loops and slice appends reported by gosimple
with simpler variants.

Specifically,

    for _, x := range src {
        dst = append(dst, x)
    }
    // can be replaced with
    dst = append(dst, src...)

And,

    for i, x := range src {
        dst[i] = x
    }
    // can be replaced with
    copy(dst, src)

And,

    for true { ... }
    // can be replaced with
    for { ... }

And, given a string `s`,

    for _, r := range []rune(s) { .. }
    // can be replaced with
    for _, r := range s { .. }

Lastly, this fixes in ineffective break statement
also reported by the linter.
Inside a switch block,
`break` affects the current `case` only.
The outer loop needs a label.
2023-01-12 09:55:34 -08:00
..
testdata [codegen/hcl2] Fix template control tokens. (#4584) 2020-05-07 09:12:00 -07:00
comments.go ci: gofmt 1.18+ clean 2022-09-21 09:48:39 -07:00
comments_test.go all: Drop ioutil 2023-01-06 16:35:14 -08:00
parser.go all: Drop ioutil 2023-01-06 16:35:14 -08:00
tokens.go gosimple: Simplify loops 2023-01-12 09:55:34 -08:00
utilities.go Update error handling (#8406) 2021-11-12 18:37:17 -08:00