Skip to content

add encoding functions#11

Open
gt814 wants to merge 1 commit intoYandex-Practicum:mainfrom
gt814:feature/encoding
Open

add encoding functions#11
gt814 wants to merge 1 commit intoYandex-Practicum:mainfrom
gt814:feature/encoding

Conversation

@gt814
Copy link
Copy Markdown

@gt814 gt814 commented Dec 4, 2023

No description provided.

Comment thread encoding/encoding.go

err = os.WriteFile(y.FileOutput, jsonFile, 0644)
if err != nil {
fmt.Println("Произошла ошибка записи JSON-файла, err=", err)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сразу про все выводы ошибок скажу. Обычно не пишут в тексте ошибки что это ошибка :) Ну, обычно пишут что-то типа "write json".
А еще не комильфо конкатенировать через аргументы. Если хотим подставить значение, то fmt.Sprintf("текст ошибки %w", err)
Еще, есть подход - все ошибки выводить с оборачиванием, а лог именно ошибки писать уже в самом верху.
Опять же, есть
return fmt.Errorf("текст ошибки %w", err)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Понял. Спасибо за обратную связь!

Copy link
Copy Markdown

@lugingf lugingf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Принято

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants