@@ -68,7 +68,7 @@ func initOptInTests() {
6868 return
6969 }
7070
71- for _ , testName := range strings .Split (optInTestsValue , "," ) {
71+ for testName := range strings .SplitSeq (optInTestsValue , "," ) {
7272 optInTests [testName ] = struct {}{}
7373 }
7474}
@@ -308,7 +308,7 @@ func CheckResourceAttrListContains(resName, path, desiredValue string) resource.
308308 return fmt .Errorf ("attribute %s does not exist" , path )
309309 }
310310
311- for i := 0 ; i < length ; i ++ {
311+ for i := range length {
312312 if rs .Primary .Attributes [path + "." + strconv .Itoa (i )] == desiredValue {
313313 return nil
314314 }
@@ -330,7 +330,7 @@ func LoopThroughStringList(resName, path string, listValidateFunc ListAttrValida
330330 return fmt .Errorf ("attribute %s does not exist" , path )
331331 }
332332
333- for i := 0 ; i < length ; i ++ {
333+ for i := range length {
334334 err := listValidateFunc (resName , path + "." + strconv .Itoa (i ), s )
335335 if err != nil {
336336 return fmt .Errorf ("Value not found:%s" , err )
@@ -354,7 +354,7 @@ func CheckListContains(resName, path, value string) resource.TestCheckFunc {
354354 return fmt .Errorf ("attribute %s does not exist" , path )
355355 }
356356
357- for i := 0 ; i < length ; i ++ {
357+ for i := range length {
358358 foundValue , ok := rs .Primary .Attributes [path + "." + strconv .Itoa (i )]
359359 if ! ok {
360360 return fmt .Errorf ("index %d does not exist in attributes" , i )
@@ -546,7 +546,7 @@ func AnyOfTestCheckFunc(funcs ...resource.TestCheckFunc) resource.TestCheckFunc
546546 }
547547}
548548
549- func ExecuteTemplate (t testing.TB , templateName string , data interface {} ) string {
549+ func ExecuteTemplate (t testing.TB , templateName string , data any ) string {
550550 t .Helper ()
551551
552552 var b bytes.Buffer
@@ -591,7 +591,7 @@ type ProviderMetaModifier func(ctx context.Context, data *schema.ResourceData, c
591591func ModifyProviderMeta (provider * schema.Provider , modifier ProviderMetaModifier ) * schema.Provider {
592592 oldConfigure := provider .ConfigureContextFunc
593593
594- provider .ConfigureContextFunc = func (ctx context.Context , data * schema.ResourceData ) (interface {} , diag.Diagnostics ) {
594+ provider .ConfigureContextFunc = func (ctx context.Context , data * schema.ResourceData ) (any , diag.Diagnostics ) {
595595 config , err := oldConfigure (ctx , data )
596596 if err != nil {
597597 return nil , err
@@ -715,13 +715,9 @@ func GetRegionsWithCaps(capabilities []string, regionType string, filters ...Reg
715715 return false
716716 })
717717
718- result := make ([]string , len (filteredRegions ))
719-
720- for i , r := range filteredRegions {
721- result [i ] = r .ID
722- }
723-
724- return result , nil
718+ return helper .MapSlice (filteredRegions , func (r linodego.Region ) string {
719+ return r .ID
720+ }), nil
725721}
726722
727723// GetRandomRegionWithCaps gets a random region given a list of region capabilities.
@@ -766,10 +762,7 @@ func GetTestClient() (*linodego.Client, error) {
766762 return nil , fmt .Errorf ("LINODE_TOKEN must be set for acceptance tests" )
767763 }
768764
769- apiVersion := os .Getenv ("LINODE_API_VERSION" )
770- if apiVersion == "" {
771- apiVersion = "v4beta"
772- }
765+ apiVersion := cmp .Or (os .Getenv ("LINODE_API_VERSION" ), "v4beta" )
773766
774767 config := & helper.Config {
775768 AccessToken : token ,
@@ -791,10 +784,7 @@ func GetTestClientAlternateToken(tokenName string) (*linodego.Client, error) {
791784 return nil , fmt .Errorf ("%s must be set for acceptance tests" , tokenName )
792785 }
793786
794- apiVersion := os .Getenv ("LINODE_API_VERSION" )
795- if apiVersion == "" {
796- apiVersion = "v4beta"
797- }
787+ apiVersion := cmp .Or (os .Getenv ("LINODE_API_VERSION" ), "v4beta" )
798788
799789 config := & helper.Config {
800790 AccessToken : token ,
0 commit comments