Skip to content

Commit

Permalink
chore: remove unused code
Browse files Browse the repository at this point in the history
Replace deprecated 'deadcode' linter, replacing it with 'unused'.
Address lint found by 'unused'.
  • Loading branch information
tri-adam committed Sep 23, 2022
1 parent 429fdb1 commit a7f5dd4
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ linters:
enable:
- containedctx
- contextcheck
- deadcode
- decorder
- dupl
- gofumpt
Expand All @@ -32,6 +31,7 @@ linters:
- nakedret
- revive
- staticcheck
- unused

linters-settings:
misspell:
Expand Down
19 changes: 1 addition & 18 deletions e2e/instance/instance_utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2021, Sylabs Inc. All rights reserved.
// Copyright (c) 2019-2022, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand Down Expand Up @@ -29,23 +29,6 @@ type instanceList struct {
Instances []instance `json:"instances"`
}

func (c *ctx) listInstance(t *testing.T, listArgs ...string) (stdout string, stderr string, success bool) {
var args []string

c.env.RunSingularity(
t,
e2e.WithProfile(c.profile),
e2e.WithCommand("instance list"),
e2e.WithArgs(args...),
e2e.PostRun(func(t *testing.T) {
success = !t.Failed()
}),
e2e.ExpectExit(0, e2e.GetStreams(&stdout, &stderr)),
)

return
}

func (c *ctx) stopInstance(t *testing.T, instance string, stopArgs ...string) (stdout string, stderr string, success bool) {
args := stopArgs

Expand Down
1 change: 0 additions & 1 deletion e2e/sign/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

type ctx struct {
env e2e.TestEnv
imgCache string
keyringDir string
passphraseInput []e2e.SingularityConsoleOp
}
Expand Down
3 changes: 1 addition & 2 deletions internal/pkg/build/sources/conveyorPacker_local.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020, Sylabs Inc. All rights reserved.
// Copyright (c) 2018-2022, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand All @@ -19,7 +19,6 @@ import (
// LocalConveyor only needs to hold the conveyor to have the needed data to pack
type LocalConveyor struct {
src string
b *types.Bundle
}

// LocalPacker ...
Expand Down
5 changes: 2 additions & 3 deletions internal/pkg/build/sources/conveyorPacker_shub.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020, Sylabs Inc. All rights reserved.
// Copyright (c) 2018-2022, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand All @@ -16,8 +16,7 @@ import (

// ShubConveyorPacker only needs to hold the conveyor to have the needed data to pack.
type ShubConveyorPacker struct {
recipe types.Definition
b *types.Bundle
b *types.Bundle
LocalPacker
}

Expand Down
15 changes: 0 additions & 15 deletions internal/pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,6 @@ func (h *Handle) CleanCache(cacheType string, dryRun bool, days int) (err error)
return err
}

// cleanAllCaches is an utility function that wipes all files in the
// cache directory, will return a error if one occurs
func (h *Handle) cleanAllCaches() {
if h.disabled {
return
}

for _, ct := range append(FileCacheTypes, OciCacheTypes...) {
dir := h.getCacheTypeDir(ct)
if err := os.RemoveAll(dir); err != nil {
sylog.Verbosef("unable to clean %s cache, directory %s: %v", ct, dir, err)
}
}
}

// IsDisabled returns true if the cache is disabled
func (h *Handle) IsDisabled() bool {
return h.disabled
Expand Down

0 comments on commit a7f5dd4

Please sign in to comment.