File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff 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" )
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ const (
1818)
1919
2020func 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 }()
Original file line number Diff line number Diff line change 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.
1314func (l * Lock ) UpdateVersion () error {
You can’t perform that action at this time.
0 commit comments