Add any type and output errors
This commit is contained in:
@@ -3,6 +3,7 @@ package files
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"password/output"
|
||||
)
|
||||
|
||||
type JsonDb struct {
|
||||
@@ -26,13 +27,13 @@ func (db *JsonDb) Read() ([]byte, error) {
|
||||
func (db *JsonDb) Write(content []byte) {
|
||||
file, err := os.Create(db.filename)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
output.PrintError(err)
|
||||
}
|
||||
defer file.Close()
|
||||
_, err = file.Write(content)
|
||||
if err != nil {
|
||||
file.Close()
|
||||
fmt.Println(err)
|
||||
output.PrintError(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("Файл успешно записан")
|
||||
|
||||
Reference in New Issue
Block a user