Skip to content

Commit

Permalink
Fix ineffassign issues & add it to CI (#156)
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Shishkin <me@teran.dev>
  • Loading branch information
teran committed Aug 17, 2024
1 parent 476640f commit 6714aa8
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ jobs:
- uses: actions/checkout@v4
- uses: articulate/actions-markdownlint@v1

ineffassign:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
- name: Install ineffassign
run: go install github.com/gordonklaus/ineffassign@latest
- name: Run ineffassign
run: ineffassign ./...

unittests:
runs-on: ubuntu-latest
steps:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ jobs:
- uses: actions/checkout@v4
- uses: articulate/actions-markdownlint@v1

ineffassign:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
- name: Install ineffassign
run: go install github.com/gordonklaus/ineffassign@latest
- name: Run ineffassign
run: ineffassign ./...

unittests:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ func main() {
cfg.BLOBS3AccessKeyID, cfg.BLOBS3SecretKey, "",
),
})
if err != nil {
panic(err)
}

s3client := s3.New(awsSession)

Expand Down
3 changes: 3 additions & 0 deletions cmd/publisher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ func main() {
cfg.BLOBS3AccessKeyID, cfg.BLOBS3SecretKey, "",
),
})
if err != nil {
panic(err)
}

blobRepo := awsBlobRepo.New(s3.New(awsSession), cfg.BLOBS3Bucket, cfg.BLOBS3PresignedLinkTTL)

Expand Down
7 changes: 3 additions & 4 deletions gc/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func (s *service) Run(ctx context.Context) error {
}

var (
total uint64 = 0
offset uint64 = 0
total uint64
offset uint64
)

for {
Expand All @@ -77,8 +77,7 @@ func (s *service) Run(ctx context.Context) error {
"limit": defaultLimit,
}).Tracef("list objects loop iteration ...")

var objects []string = []string{}

var objects []string
total, objects, err = s.cfg.MdRepo.ListObjects(ctx, container, version.Name, offset, defaultLimit)
if err != nil {
return errors.Wrapf(err, "error listing objects for container `%s`; version `%s`", container, version.Name)
Expand Down
3 changes: 3 additions & 0 deletions repositories/metadata/postgresql/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func (r *repository) CountStats(ctx context.Context) (*models.Stats, error) {
GroupBy("c.name", "v.name", "v.is_published").
OrderBy("c.name", "v.name", "v.is_published"),
)
if err != nil {
return nil, err
}

for rows.Next() {
brsb := models.BlobsRawSizeBytes{}
Expand Down

0 comments on commit 6714aa8

Please sign in to comment.