@@ -64,8 +64,7 @@ func GetNonEmptyLines(output string) []string {
6464
6565// InsertCode searches target content in the file and insert `toInsert` after the target.
6666func InsertCode (filename , target , code string ) error {
67- // false positive
68- // nolint:gosec
67+ //nolint:gosec // false positive
6968 contents , err := os .ReadFile (filename )
7069 if err != nil {
7170 return err
@@ -75,15 +74,13 @@ func InsertCode(filename, target, code string) error {
7574 return fmt .Errorf ("string %s not found in %s" , target , string (contents ))
7675 }
7776 out := string (contents [:idx + len (target )]) + code + string (contents [idx + len (target ):])
78- // false positive
79- // nolint:gosec
77+ //nolint:gosec // false positive
8078 return os .WriteFile (filename , []byte (out ), 0644 )
8179}
8280
8381// InsertCodeIfNotExist insert code if it does not already exists
8482func InsertCodeIfNotExist (filename , target , code string ) error {
85- // false positive
86- // nolint:gosec
83+ //nolint:gosec // false positive
8784 contents , err := os .ReadFile (filename )
8885 if err != nil {
8986 return err
@@ -130,8 +127,7 @@ func AppendCodeAtTheEnd(filename, code string) error {
130127// UncommentCode searches for target in the file and remove the comment prefix
131128// of the target content. The target content may span multiple lines.
132129func UncommentCode (filename , target , prefix string ) error {
133- // false positive
134- // nolint:gosec
130+ //nolint:gosec // false positive
135131 content , err := os .ReadFile (filename )
136132 if err != nil {
137133 return err
@@ -171,8 +167,7 @@ func UncommentCode(filename, target, prefix string) error {
171167 if err != nil {
172168 return err
173169 }
174- // false positive
175- // nolint:gosec
170+ //nolint:gosec // false positive
176171 return os .WriteFile (filename , out .Bytes (), 0644 )
177172}
178173
@@ -232,8 +227,7 @@ func ReplaceInFile(path, oldValue, newValue string) error {
232227 if err != nil {
233228 return err
234229 }
235- // false positive
236- // nolint:gosec
230+ //nolint:gosec // false positive
237231 b , err := os .ReadFile (path )
238232 if err != nil {
239233 return err
@@ -260,8 +254,7 @@ func ReplaceRegexInFile(path, match, replace string) error {
260254 if err != nil {
261255 return err
262256 }
263- // false positive
264- // nolint:gosec
257+ //nolint:gosec // false positive
265258 b , err := os .ReadFile (path )
266259 if err != nil {
267260 return err
@@ -279,7 +272,7 @@ func ReplaceRegexInFile(path, match, replace string) error {
279272
280273// HasFileContentWith check if given `text` can be found in file
281274func HasFileContentWith (path , text string ) (bool , error ) {
282- // nolint:gosec
275+ //nolint:gosec
283276 contents , err := os .ReadFile (path )
284277 if err != nil {
285278 return false , err
0 commit comments