Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go-ranks: AWS patches for migration (+ Go upgrade) #43

Merged
merged 11 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.18.x]
go-version: [1.23.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -23,8 +23,8 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
args: --timeout=5m
version: v1.60.1
args: --new-from-rev=master --timeout=5m
install-mode: binary
- name: Tests
run: |
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18.x
go-version: 1.23.x

- name: Checkout code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.18.x"
go-version: "1.23.x"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
50 changes: 25 additions & 25 deletions api/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,36 @@ func initAws(ctx context.Context) {
log.Info(ctx, "AWS not enabled in config")
return
}
var providers []credentials.Provider
rraulinio marked this conversation as resolved.
Show resolved Hide resolved
if config.AWS.AccessKey != "" && config.AWS.SecretKey != "" {
providers = append(providers, &credentials.StaticProvider{Value: credentials.Value{
AccessKeyID: config.AWS.AccessKey,
SecretAccessKey: config.AWS.SecretKey,
SessionToken: "",
}})
}

providers = append(providers,
&ec2rolecreds.EC2RoleProvider{
Client: ec2metadata.New(session.Must(session.NewSession())),
})
providers = append(providers, &credentials.EnvProvider{})

creds := credentials.NewChainCredentials(providers)
_, err := creds.Get()
if err != nil {
log.Error(ctx, "AWS not initialized", "error", err.Error())
return
}
cfg := aws.NewConfig().WithRegion(config.AWS.Region).WithCredentials(creds)
cfg := aws.NewConfig().WithRegion(config.AWS.Region)
if config.AWS.S3Endpoint != "" {
cfg = cfg.WithEndpoint(config.AWS.S3Endpoint)
}
awsSession, err = session.NewSession(cfg)
if err != nil {
log.Error(ctx, "AWS not initialized. Unable to create session.", "error", err.Error())
return

if config.AWS.AccessKey != "" && config.AWS.SecretKey != "" {
providers := []credentials.Provider{
&credentials.StaticProvider{
Value: credentials.Value{
AccessKeyID: config.AWS.AccessKey,
SecretAccessKey: config.AWS.SecretKey,
SessionToken: "",
},
},
&ec2rolecreds.EC2RoleProvider{
Client: ec2metadata.New(session.Must(session.NewSession())),
},
&credentials.EnvProvider{},
}

creds := credentials.NewChainCredentials(providers)
_, err := creds.Get()
if err != nil {
log.Error(ctx, "AWS not initialized", "error", err.Error())
return
}
cfg = cfg.WithCredentials(creds)
}

awsSession = session.Must(session.NewSession(cfg))
log.Info(ctx, "AWS initialized")
}
2 changes: 1 addition & 1 deletion api/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (c *ListsController) Create(ctx *app.CreateListsContext) error {
opts = append(opts, rankdb.WithListOption.Metadata(ctx.Payload.Metadata))
opts = append(opts, rankdb.WithListOption.MergeSplitSize(ctx.Payload.MergeSize, ctx.Payload.SplitSize))
opts = append(opts, rankdb.WithListOption.LoadIndex(ctx.Payload.LoadIndex))
if ctx.Payload.Populate != nil && len(ctx.Payload.Populate) > 0 {
if len(ctx.Payload.Populate) > 0 {
elems := morph.ApiElements{In: ctx.Payload.Populate}.Elements()
elems.UpdateTime(time.Now())
elems.Deduplicate()
Expand Down
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/Vivino/rankdb

go 1.18
go 1.23

require (
github.com/BurntSushi/toml v1.3.2
github.com/aerospike/aerospike-client-go/v6 v6.12.0
github.com/aws/aws-sdk-go v1.42.24
github.com/aws/aws-sdk-go v1.55.6
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/dgraph-io/badger v1.6.0
github.com/goadesign/goa v1.4.3
Expand All @@ -23,8 +23,8 @@ require (
github.com/tinylib/msgp v1.1.2
github.com/ugorji/go/codec v1.1.7
go.etcd.io/bbolt v1.3.5
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/tools v0.13.0
golang.org/x/lint v0.0.0-20241112194109-818c5a804067
golang.org/x/tools v0.29.0
gopkg.in/DataDog/dd-trace-go.v1 v1.37.0
)

Expand Down Expand Up @@ -68,7 +68,7 @@ require (
github.com/apex/log v1.9.0 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/atc0005/go-teams-notify/v2 v2.6.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2 v1.36.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.11.0 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.6.4 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.8.2 // indirect
Expand All @@ -79,7 +79,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/kms v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.6.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.11.1 // indirect
github.com/aws/smithy-go v1.11.0 // indirect
github.com/aws/smithy-go v1.22.2 // indirect
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect
github.com/caarlos0/ctrlc v1.0.0 // indirect
github.com/caarlos0/env/v6 v6.8.0 // indirect
Expand Down Expand Up @@ -164,13 +164,13 @@ require (
gitlab.com/digitalxero/go-conventional-commit v1.0.7 // indirect
go.opencensus.io v0.24.0 // indirect
gocloud.dev v0.24.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.126.0 // indirect
Expand Down
Loading
Loading