Skip to content

Conversation

@sofiiakulish
Copy link
Owner

@sofiiakulish sofiiakulish commented Sep 25, 2022

Домашнее задание №8 «Утилита envdir»

Чек-лист студента (Что это?)

Критерии оценки

  • Пайплайн зелёный - 4 балла
  • Добавлены юнит-тесты - до 4 баллов
  • Понятность и чистота кода - до 2 баллов

Зачёт от 7 баллов

Copy link
Collaborator

@agneum agneum left a comment

Choose a reason for hiding this comment

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

Спасибо за выполненное задание. Хорошая работа
Итого: 10 баллов из 10. Принято


result := make(Environment)

files, err := ioutil.ReadDir(dir)
Copy link
Collaborator

Choose a reason for hiding this comment

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

С Go 1.16 функции пакета ioutil помечены как deprecated, рекомендуется использовать функции пакета io и os: https://go.dev/doc/go1.16#ioutil

return "", true, nil
}

file, err := os.Open(dir + "/" + fileInfo.Name())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Для получения пути к файлу рекомендую использовать https://pkg.go.dev/path/filepath#Join

func createTestDir(dir string) {
err := os.MkdirAll(dir, os.ModePerm)
if err != nil {
panic(fmt.Errorf("Error creating test directory: %w", err))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Желательно не паниковать, даже в тестах. Предложил бы использовать функции пакета testify/require


err := command.Start()
if err != nil {
panic(err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

В программе особенно не рекомендуется паниковать. Обработанная ошибка для пользователя будет выглядеть гораздо понятнее

@@ -1,3 +1,5 @@
module github.com/fixme_my_friend/hw08_envdir_tool
module github.com/sofiiakulish/hw08_envdir_tool
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
module github.com/sofiiakulish/hw08_envdir_tool
module github.com/sofiiakulish/hw/hw08_envdir_tool

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.

3 participants