Skip to content

Commit 0979331

Browse files
committed
fix lint
1 parent 1ffbcfd commit 0979331

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

cmd/handlers/lock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func defaultConfigPath() string {
3636
return basePath + "/.config/hipapu/lock.json"
3737
}
3838

39-
func (h *ActionHandlers) checkAndMigrateLockIfExists(_ io.Reader, out io.Writer) error {
39+
func (*ActionHandlers) checkAndMigrateLockIfExists(_ io.Reader, out io.Writer) error {
4040
newPath := defaultConfigPath()
4141

4242
oldPath := filepath.Clean(filepath.Dir(newPath) + "/config.json")

internal/lock/save.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const (
1818
)
1919

2020
func createBackup(path string) error {
21+
path = filepath.Clean(path)
22+
2123
stat, err := os.Open(path)
2224
if err != nil && !os.IsNotExist(err) {
2325
return fmt.Errorf("failed to stat original file for backup: %w", err)
@@ -31,14 +33,16 @@ func createBackup(path string) error {
3133
if err != nil {
3234
return fmt.Errorf("failed to open source file: %w", err)
3335
}
36+
3437
defer func() {
3538
_ = srcFile.Close()
3639
}()
3740

38-
backupFile, err := os.Create(path + ".backup." + strconv.FormatInt(time.Now().Unix(), 10))
41+
backupFile, err := os.Create(path + ".backup." + strconv.FormatInt(time.Now().Unix(), 10)) //nolint:gosec
3942
if err != nil {
4043
return fmt.Errorf("failed to create backup: %w", err)
4144
}
45+
4246
defer func() {
4347
_ = backupFile.Close()
4448
}()

internal/lock/update.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import (
77
"golang.org/x/mod/semver"
88
)
99

10-
var ErrUnsupportedVersion = errors.New("unsupported lockfile verison")
10+
// ErrUnsupportedVersion - unsupported lockfile version.
11+
var ErrUnsupportedVersion = errors.New("unsupported lockfile version")
1112

1213
// UpdateVersion updates lockfile format making a backup.
1314
func (l *Lock) UpdateVersion() error {

0 commit comments

Comments
 (0)