@@ -17,7 +17,6 @@ import (
1717 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1818 "github.com/scaleway/scaleway-sdk-go/namegenerator"
1919 "github.com/scaleway/scaleway-sdk-go/scw"
20- "golang.org/x/xerrors"
2120)
2221
2322// DefaultWaitRetryInterval is used to set the retry interval to 0 during acceptance tests
@@ -42,7 +41,7 @@ func newRegionalID(region scw.Region, id string) RegionalID {
4241
4342func expandRegionalID (id interface {}) RegionalID {
4443 regionalID := RegionalID {}
45- tab := strings .SplitN (id .(string ), "/" , - 1 )
44+ tab := strings .Split (id .(string ), "/" )
4645 if len (tab ) != 2 {
4746 regionalID .ID = id .(string )
4847 } else {
@@ -73,7 +72,7 @@ func newZonedID(zone scw.Zone, id string) ZonedID {
7372
7473func expandZonedID (id interface {}) ZonedID {
7574 zonedID := ZonedID {}
76- tab := strings .SplitN (id .(string ), "/" , - 1 )
75+ tab := strings .Split (id .(string ), "/" )
7776 if len (tab ) != 2 {
7877 zonedID .ID = id .(string )
7978 } else {
@@ -86,8 +85,8 @@ func expandZonedID(id interface{}) ZonedID {
8685}
8786
8887// parseLocalizedID parses a localizedID and extracts the resource locality and id.
89- func parseLocalizedID (localizedID string ) (locality string , ID string , err error ) {
90- tab := strings .SplitN (localizedID , "/" , - 1 )
88+ func parseLocalizedID (localizedID string ) (locality string , id string , err error ) {
89+ tab := strings .Split (localizedID , "/" )
9190 if len (tab ) != 2 {
9291 return "" , localizedID , fmt .Errorf ("cant parse localized id: %s" , localizedID )
9392 }
@@ -96,7 +95,7 @@ func parseLocalizedID(localizedID string) (locality string, ID string, err error
9695
9796// parseLocalizedNestedID parses a localizedNestedID and extracts the resource locality, the inner and outer id.
9897func parseLocalizedNestedID (localizedID string ) (locality string , innerID , outerID string , err error ) {
99- tab := strings .SplitN (localizedID , "/" , - 1 )
98+ tab := strings .Split (localizedID , "/" )
10099 if len (tab ) != 3 {
101100 return "" , "" , localizedID , fmt .Errorf ("cant parse localized id: %s" , localizedID )
102101 }
@@ -217,7 +216,7 @@ func isHTTPCodeError(err error, statusCode int) bool {
217216 }
218217
219218 responseError := & scw.ResponseError {}
220- if xerrors .As (err , & responseError ) && responseError .StatusCode == statusCode {
219+ if errors .As (err , & responseError ) && responseError .StatusCode == statusCode {
221220 return true
222221 }
223222 return false
@@ -226,25 +225,25 @@ func isHTTPCodeError(err error, statusCode int) bool {
226225// is404Error returns true if err is an HTTP 404 error
227226func is404Error (err error ) bool {
228227 notFoundError := & scw.ResourceNotFoundError {}
229- return isHTTPCodeError (err , http .StatusNotFound ) || xerrors .As (err , & notFoundError )
228+ return isHTTPCodeError (err , http .StatusNotFound ) || errors .As (err , & notFoundError )
230229}
231230
232231func is412Error (err error ) bool {
233232 preConditionFailedError := & scw.PreconditionFailedError {}
234- return isHTTPCodeError (err , http .StatusPreconditionFailed ) || xerrors .As (err , & preConditionFailedError )
233+ return isHTTPCodeError (err , http .StatusPreconditionFailed ) || errors .As (err , & preConditionFailedError )
235234}
236235
237236// is403Error returns true if err is an HTTP 403 error
238237func is403Error (err error ) bool {
239238 permissionsDeniedError := & scw.PermissionsDeniedError {}
240- return isHTTPCodeError (err , http .StatusForbidden ) || xerrors .As (err , & permissionsDeniedError )
239+ return isHTTPCodeError (err , http .StatusForbidden ) || errors .As (err , & permissionsDeniedError )
241240}
242241
243242// is409Error return true is err is an HTTP 409 error
244243func is409Error (err error ) bool {
245244 // check transient error
246245 transientStateError := & scw.TransientStateError {}
247- return isHTTPCodeError (err , http .StatusConflict ) || xerrors .As (err , & transientStateError )
246+ return isHTTPCodeError (err , http .StatusConflict ) || errors .As (err , & transientStateError )
248247}
249248
250249// organizationIDSchema returns a standard schema for a organization_id
@@ -558,7 +557,7 @@ func diffSuppressFuncIgnoreCase(k, oldValue, newValue string, d *schema.Resource
558557}
559558
560559func diffSuppressFuncIgnoreCaseAndHyphen (k , oldValue , newValue string , d * schema.ResourceData ) bool {
561- return strings .Replace (strings .ToLower (oldValue ), "-" , "_" , - 1 ) == strings .Replace (strings .ToLower (newValue ), "-" , "_" , - 1 )
560+ return strings .ReplaceAll (strings .ToLower (oldValue ), "-" , "_" ) == strings .ReplaceAll (strings .ToLower (newValue ), "-" , "_" )
562561}
563562
564563// diffSuppressFuncLocality is a SuppressDiffFunc to remove the locality from an ID when checking diff.
0 commit comments