66 "errors"
77 "fmt"
88 "io"
9- "io/ioutil"
109 "os"
1110 "path/filepath"
1211 "strings"
@@ -53,7 +52,7 @@ func newEnvironment(io ui.IO, newClient newClientFunc) *environment {
5352 io : io ,
5453 newClient : newClient ,
5554 osEnv : os .Environ (),
56- readFile : ioutil .ReadFile ,
55+ readFile : os .ReadFile ,
5756 osStat : os .Stat ,
5857 templateVars : make (map [string ]string ),
5958 envar : make (map [string ]string ),
@@ -348,7 +347,7 @@ type EnvDir map[string]value
348347// NewEnvDir sources environment variables from files in a given directory,
349348// using the file name as key and contents as value.
350349func NewEnvDir (path string ) (EnvDir , error ) {
351- files , err := ioutil .ReadDir (path )
350+ files , err := os .ReadDir (path )
352351 if err != nil {
353352 return nil , ErrReadEnvDir (err )
354353 }
@@ -357,7 +356,7 @@ func NewEnvDir(path string) (EnvDir, error) {
357356 for _ , f := range files {
358357 if ! f .IsDir () {
359358 filePath := filepath .Join (path , f .Name ())
360- fileContent , err := ioutil .ReadFile (filePath )
359+ fileContent , err := os .ReadFile (filePath )
361360 if err != nil {
362361 return nil , ErrReadEnvFile (f .Name (), err )
363362 }
@@ -603,12 +602,12 @@ const (
603602// it is wrapped in either single or double quotes.
604603//
605604// Rules:
606- // - Empty values become empty values (e.g. `'' `and `""` both evaluate to the empty string `` ).
607- // - Inner quotes are maintained (e.g. `{"foo":"bar"}` remains unchanged).
608- // - Single and double quoted values are escaped (e.g. `'foo'` and `"foo"` both evaluate to `foo`).
609- // - Single and double qouted values maintain whitespace from both ends (e.g. `" foo "` becomes ` foo `)
610- // - Inputs with either leading or trailing whitespace are considered unquoted,
611- // so make sure you sanitize your inputs before calling this function.
605+ // - Empty values become empty values (e.g. `” `and `""` both evaluate to the empty string “ ).
606+ // - Inner quotes are maintained (e.g. `{"foo":"bar"}` remains unchanged).
607+ // - Single and double quoted values are escaped (e.g. `'foo'` and `"foo"` both evaluate to `foo`).
608+ // - Single and double qouted values maintain whitespace from both ends (e.g. `" foo "` becomes ` foo `)
609+ // - Inputs with either leading or trailing whitespace are considered unquoted,
610+ // so make sure you sanitize your inputs before calling this function.
612611func trimQuotes (s string ) (string , bool ) {
613612 n := len (s )
614613 if n > 1 &&
@@ -621,7 +620,7 @@ func trimQuotes(s string) (string, bool) {
621620}
622621
623622func parseYML (r io.Reader ) ([]envvar , error ) {
624- contents , err := ioutil .ReadAll (r )
623+ contents , err := io .ReadAll (r )
625624 if err != nil {
626625 return nil , err
627626 }
0 commit comments