Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-hajek authored and l-hellmann committed May 4, 2024
1 parent 2380fc0 commit f799087
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@ test:
lint:
GOOS=darwin GOARCH=arm64 gomodrun golangci-lint run ./cmd/... ./src/... --verbose
GOOS=linux GOARCH=amd64 gomodrun golangci-lint run ./cmd/... ./src/... --verbose
GOOS=windows GOARCH=amd64 gomodrun golangci-lint run ./cmd/... ./src/... --verbose
GOOS=windows GOARCH=amd64 gomodrun golangci-lint run ./cmd/... ./src/... --verbose

build-for-windows-amd:
GOOS=windows GOARCH=amd64 go build -o bin/zcli.exe cmd/zcli/main.go

build-for-linux-amd:
GOOS=linux GOARCH=amd64 go build -o bin/zcli cmd/zcli/main.go

build-for-darwin-arm:
GOOS=darwin GOARCH=arm64 go build -o bin/zcli cmd/zcli/main.go
8 changes: 2 additions & 6 deletions src/storage/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,11 @@ func (h *Handler[T]) save(data T) error {
}(); err != nil {
return err
}
if err := os.Remove(h.config.FilePath); err != nil {
return errors.WithStack(err)
}
os.Remove(h.config.FilePath)
defer os.Remove(h.config.FilePath + ".new")
if err := os.Rename(h.config.FilePath+".new", h.config.FilePath); err != nil {
return errors.WithStack(err)
}
if err := os.Remove(h.config.FilePath + ".new"); err != nil {
return errors.WithStack(err)
}
return nil
}

Expand Down

0 comments on commit f799087

Please sign in to comment.