6
6
"crypto/rsa"
7
7
"errors"
8
8
"fmt"
9
- "io/ioutil"
10
9
"os"
11
10
"regexp"
12
11
"strings"
@@ -198,7 +197,7 @@ func parseConfigFile(data []byte, profile string) (info *configFileInfo, err err
198
197
199
198
//Look for profile
200
199
for i , line := range splitContent {
201
- if match := profileRegex .FindStringSubmatch (line ); match != nil && len (match ) > 1 && match [1 ] == profile {
200
+ if match := profileRegex .FindStringSubmatch (line ); len (match ) > 1 && match [1 ] == profile {
202
201
start := i + 1
203
202
return parseConfigAtLine (start , splitContent )
204
203
}
@@ -257,7 +256,7 @@ func openConfigFile(configFilePath string) (data []byte, err error) {
257
256
return
258
257
}
259
258
260
- data , err = ioutil .ReadFile (expandedPath )
259
+ data , err = os .ReadFile (expandedPath )
261
260
if err != nil {
262
261
err = fmt .Errorf ("can not read config file: %s due to: %s" , configFilePath , err .Error ())
263
262
}
@@ -272,7 +271,7 @@ func readTokenFromFile(tokenFilePath string) (string, error) {
272
271
return "" , err
273
272
}
274
273
275
- data , err := ioutil .ReadFile (expandedPath )
274
+ data , err := os .ReadFile (expandedPath )
276
275
if err != nil {
277
276
err = fmt .Errorf ("can not read token file: %s due to: %s" , tokenFilePath , err .Error ())
278
277
return "" , err
@@ -404,7 +403,7 @@ func (p fileConfigurationProvider) PrivateRSAKey() (key *rsa.PrivateKey, err err
404
403
return
405
404
}
406
405
407
- pemFileContent , err := ioutil .ReadFile (expandedPath )
406
+ pemFileContent , err := os .ReadFile (expandedPath )
408
407
if err != nil {
409
408
err = fmt .Errorf ("can not read PrivateKey %s from configuration file due to: %s" , filePath , err .Error ())
410
409
return
@@ -439,7 +438,7 @@ func (p fileConfigurationProvider) Region() (value string, err error) {
439
438
return canStringBeRegion (value )
440
439
}
441
440
442
- var blankRegex = regexp .MustCompile (" \\ s" )
441
+ var blankRegex = regexp .MustCompile (`\s` )
443
442
444
443
func canStringBeRegion (stringRegion string ) (region string , err error ) {
445
444
if blankRegex .MatchString (stringRegion ) || stringRegion == "" {
0 commit comments