@@ -64,8 +64,7 @@ func GetNonEmptyLines(output string) []string {
64
64
65
65
// InsertCode searches target content in the file and insert `toInsert` after the target.
66
66
func InsertCode (filename , target , code string ) error {
67
- // false positive
68
- // nolint:gosec
67
+ //nolint:gosec // false positive
69
68
contents , err := os .ReadFile (filename )
70
69
if err != nil {
71
70
return err
@@ -75,15 +74,13 @@ func InsertCode(filename, target, code string) error {
75
74
return fmt .Errorf ("string %s not found in %s" , target , string (contents ))
76
75
}
77
76
out := string (contents [:idx + len (target )]) + code + string (contents [idx + len (target ):])
78
- // false positive
79
- // nolint:gosec
77
+ //nolint:gosec // false positive
80
78
return os .WriteFile (filename , []byte (out ), 0644 )
81
79
}
82
80
83
81
// InsertCodeIfNotExist insert code if it does not already exists
84
82
func InsertCodeIfNotExist (filename , target , code string ) error {
85
- // false positive
86
- // nolint:gosec
83
+ //nolint:gosec // false positive
87
84
contents , err := os .ReadFile (filename )
88
85
if err != nil {
89
86
return err
@@ -130,8 +127,7 @@ func AppendCodeAtTheEnd(filename, code string) error {
130
127
// UncommentCode searches for target in the file and remove the comment prefix
131
128
// of the target content. The target content may span multiple lines.
132
129
func UncommentCode (filename , target , prefix string ) error {
133
- // false positive
134
- // nolint:gosec
130
+ //nolint:gosec // false positive
135
131
content , err := os .ReadFile (filename )
136
132
if err != nil {
137
133
return err
@@ -171,8 +167,7 @@ func UncommentCode(filename, target, prefix string) error {
171
167
if err != nil {
172
168
return err
173
169
}
174
- // false positive
175
- // nolint:gosec
170
+ //nolint:gosec // false positive
176
171
return os .WriteFile (filename , out .Bytes (), 0644 )
177
172
}
178
173
@@ -232,8 +227,7 @@ func ReplaceInFile(path, oldValue, newValue string) error {
232
227
if err != nil {
233
228
return err
234
229
}
235
- // false positive
236
- // nolint:gosec
230
+ //nolint:gosec // false positive
237
231
b , err := os .ReadFile (path )
238
232
if err != nil {
239
233
return err
@@ -260,8 +254,7 @@ func ReplaceRegexInFile(path, match, replace string) error {
260
254
if err != nil {
261
255
return err
262
256
}
263
- // false positive
264
- // nolint:gosec
257
+ //nolint:gosec // false positive
265
258
b , err := os .ReadFile (path )
266
259
if err != nil {
267
260
return err
@@ -279,7 +272,7 @@ func ReplaceRegexInFile(path, match, replace string) error {
279
272
280
273
// HasFileContentWith check if given `text` can be found in file
281
274
func HasFileContentWith (path , text string ) (bool , error ) {
282
- // nolint:gosec
275
+ //nolint:gosec
283
276
contents , err := os .ReadFile (path )
284
277
if err != nil {
285
278
return false , err
0 commit comments