From fc47dc8bc9e4d68759ad5b313429dfc361df68af Mon Sep 17 00:00:00 2001 From: Siham Aissaoui Date: Tue, 23 Apr 2024 15:41:20 +0200 Subject: [PATCH] fix(s3): update go version --- storage/go.mod | 2 +- storage/go.sum | 5 +++++ storage/s3.go | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/storage/go.mod b/storage/go.mod index 986924df..71767660 100644 --- a/storage/go.mod +++ b/storage/go.mod @@ -1,6 +1,6 @@ module github.com/Scalingo/go-utils/storage -go 1.20 +go 1.21 require ( github.com/Scalingo/go-utils/logger v1.2.0 diff --git a/storage/go.sum b/storage/go.sum index 979f4f18..106d7dfc 100644 --- a/storage/go.sum +++ b/storage/go.sum @@ -37,6 +37,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +<<<<<<< HEAD +======= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +>>>>>>> 9ef694d (fix(s3): update go version) github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= diff --git a/storage/s3.go b/storage/s3.go index 18181919..1bcc7f0a 100644 --- a/storage/s3.go +++ b/storage/s3.go @@ -305,6 +305,7 @@ func s3Config(cfg S3Config) aws.Config { } if cfg.Endpoint != "" { if endpointIsAllowed(cfg.Endpoint) { + //nolint:all // AWS v1 function is deprecated, switching to v2 requires a refactoring of the package config.EndpointResolverWithOptions = aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://" + cfg.Endpoint, @@ -334,10 +335,9 @@ func getAllowListFromEnv() []string { func endpointIsAllowed(endpoint string) bool { allowedEndpoints := getAllowListFromEnv() if allowedEndpoints != nil { - return slices.IndexFunc(getAllowListFromEnv(), func(allowedEndpoint string) bool { + return slices.ContainsFunc(getAllowListFromEnv(), func(allowedEndpoint string) bool { return strings.HasPrefix(endpoint, allowedEndpoint) - }) != -1 + }) } - return true }