Skip to content

Commit

Permalink
all: fix golangci failures
Browse files Browse the repository at this point in the history
Change-Id: I07421388d53c837e35a4727cead26fc21c324d04
  • Loading branch information
egonelbre committed Aug 9, 2023
1 parent 9e3d54f commit dc41978
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion cmd/storj-sim/process.go
Expand Up @@ -255,7 +255,8 @@ func (process *Process) Exec(ctx context.Context, command string) (err error) {

if _, ok := process.Arguments[command]; !ok {
fmt.Fprintf(process.processes.Output, "%s running: %s\n", process.Name, command)
return
//TODO: This doesn't look right, but keeping the same behaviour as before.
return nil
}

cmd := exec.CommandContext(ctx, executable, process.Arguments[command]...)
Expand Down
4 changes: 2 additions & 2 deletions satellite/admin/project.go
Expand Up @@ -656,15 +656,15 @@ func (server *Server) checkUsage(ctx context.Context, w http.ResponseWriter, pro
if err != nil {
sendJSONError(w, "unable to get project details",
err.Error(), http.StatusInternalServerError)
return
return false
}

// If user is paid tier, check the usage limit, otherwise it is ok to delete it.
paid, err := server.db.Console().Users().GetUserPaidTier(ctx, prj.OwnerID)
if err != nil {
sendJSONError(w, "unable to project owner tier",
err.Error(), http.StatusInternalServerError)
return
return false
}
if paid {
// check current month usage and do not allow deletion if usage exists
Expand Down
8 changes: 3 additions & 5 deletions satellite/console/consoleweb/consoleapi/auth_test.go
Expand Up @@ -199,16 +199,14 @@ func TestDeleteAccount(t *testing.T) {
authController := consoleapi.NewAuth(log, nil, nil, nil, nil, nil, "", "", "", "", "", "")
authController.DeleteAccount(rr, r)

//nolint:bodyclose
result := rr.Result()
defer func() {
err := result.Body.Close()
require.NoError(t, err)
}()

body, err := io.ReadAll(result.Body)
require.NoError(t, err)

err = result.Body.Close()
require.NoError(t, err)

return result.StatusCode, body

}
Expand Down
3 changes: 2 additions & 1 deletion satellite/metabase/commit_object.go
Expand Up @@ -264,8 +264,9 @@ func convertToFinalSegments(segmentsInDatabase []segmentInfoForCommit) (commit [
// updateSegmentOffsets updates segment offsets that didn't match the database state.
func updateSegmentOffsets(ctx context.Context, tx tagsql.Tx, streamID uuid.UUID, updates []segmentToCommit) (err error) {
defer mon.Task()(&ctx)(&err)

if len(updates) == 0 {
return
return nil
}

// We may be able to skip this, if the database state have been already submitted
Expand Down
4 changes: 2 additions & 2 deletions satellite/satellitedb/overlaycache.go
Expand Up @@ -363,7 +363,7 @@ func (cache *overlaycache) GetOfflineNodesForEmail(ctx context.Context, offlineW
LIMIT $4
`, now.Add(-offlineWindow), now.Add(-cutoff), now.Add(-cooldown), limit)
if err != nil {
return
return nil, Error.Wrap(err)
}
defer func() { err = errs.Combine(err, rows.Close()) }()

Expand All @@ -374,7 +374,7 @@ func (cache *overlaycache) GetOfflineNodesForEmail(ctx context.Context, offlineW
err = rows.Scan(&idBytes, &email)
nodeID, err = storj.NodeIDFromBytes(idBytes)
if err != nil {
return
return nil, Error.Wrap(err)
}
nodes[nodeID] = email
}
Expand Down
2 changes: 1 addition & 1 deletion storagenode/pieces/filewalker.go
Expand Up @@ -140,7 +140,7 @@ func (fw *FileWalker) WalkSatellitePiecesToTrash(ctx context.Context, satelliteI
defer mon.Task()(&ctx)(&err)

if filter == nil {
return
return nil, 0, 0, Error.New("filter not specified")
}

err = fw.WalkSatellitePieces(ctx, satelliteID, func(access StoredPieceAccess) error {
Expand Down

0 comments on commit dc41978

Please sign in to comment.