Skip to content

Commit

Permalink
fix(s3): update go version
Browse files Browse the repository at this point in the history
  • Loading branch information
sihamais committed Apr 23, 2024
1 parent 439e099 commit fc47dc8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion storage/go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions storage/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
6 changes: 3 additions & 3 deletions storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}

0 comments on commit fc47dc8

Please sign in to comment.