Skip to content

Commit

Permalink
Context Management (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
sequel21 authored Nov 22, 2024
1 parent 28a19cc commit 15f40dc
Show file tree
Hide file tree
Showing 139 changed files with 1,939 additions and 1,712 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: 1.22

- name: Update packages list
run: sudo apt-get update
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: 1.22
- uses: actions/cache@v3
with:
path: |
Expand All @@ -75,7 +75,7 @@ jobs:
- uses: zencargo/github-action-go-mod-tidy@v1
with:
path: .
go-version: '1.20'
go-version: 1.22

test:
runs-on: ubuntu-latest
Expand All @@ -89,7 +89,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: 1.22
- name: Set up Cache
uses: actions/cache@v3
with:
Expand Down
15 changes: 11 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ linters-settings:
- unnamedResult
- unnecessaryBlock
- whyNoLint
gosec:
excludes:
- G115 # Potential integer overflow when converting between integer types
govet:
check-shadowing: false
enable:
# report about shadowed variables
- shadowing
nolintlint:
require-explanation: false
require-specific: true
Expand All @@ -49,16 +54,16 @@ linters:
- asciicheck
- bidichk
- bodyclose
- containedctx
# - containedctx
- contextcheck
- copyloopvar
# - depguard
- dogsled
# - dupl
- durationcheck
- errcheck
- errname
- errorlint
- exportloopref
- exhaustive
- goconst
- gocritic
Expand Down Expand Up @@ -92,5 +97,7 @@ linters:

run:
issues-exit-code: 1
skip-dirs:
go: '1.22'
issues:
exclude-dirs:
- contexts
6 changes: 3 additions & 3 deletions cmd/lockerd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ func RunServer(c *cli.Context) error {
// start MetaLocker server

srv := node.NewMetaLockerServer(configDir)
if err = srv.InitServices(cfg, c.Bool("debug")); err != nil {
if err = srv.InitServices(c.Context, cfg, c.Bool("debug")); err != nil {
return err
}

if err = srv.InitAuthentication(cfg); err != nil {
if err = srv.InitAuthentication(c.Context, cfg); err != nil {
return err
}

if err = srv.InitStandardRoutes(cfg); err != nil {
if err = srv.InitStandardRoutes(c.Context, cfg); err != nil {
return err
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/metalo/actions/access_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func GenerateAccessKey(c *cli.Context) error {
return err
}

ak, err := dataWallet.CreateAccessKey(dataWallet.Account().AccessLevel, time.Hour*24*365)
ak, err := dataWallet.CreateAccessKey(c.Context, dataWallet.Account().AccessLevel, time.Hour*24*365)
if err != nil {
return err
}
Expand All @@ -53,7 +53,7 @@ func ListAccessKeys(c *cli.Context) error {
return err
}

accessKeys, err := dataWallet.AccessKeys()
accessKeys, err := dataWallet.AccessKeys(c.Context)
if err != nil {
return cli.Exit(err.Error(), OperationFailed)
}
Expand Down Expand Up @@ -87,7 +87,7 @@ func GetAccessKey(c *cli.Context) error {
return err
}

ak, err := dw.GetAccessKey(c.Args().Get(0))
ak, err := dw.GetAccessKey(c.Context, c.Args().Get(0))
if err != nil {
return cli.Exit(err.Error(), OperationFailed)
}
Expand All @@ -107,5 +107,5 @@ func DeleteAccessKey(c *cli.Context) error {
return err
}

return dw.RevokeAccessKey(c.Args().Get(0))
return dw.RevokeAccessKey(c.Context, c.Args().Get(0))
}
Loading

0 comments on commit 15f40dc

Please sign in to comment.