Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Инкремент 18. Документация #61

Merged
merged 19 commits into from
Dec 27, 2023
Merged

Инкремент 18. Документация #61

merged 19 commits into from
Dec 27, 2023

Conversation

thefrol
Copy link
Owner

@thefrol thefrol commented Dec 25, 2023

Документирование

Такое уж дело, что у меня все лежит в internal, так что документировать особо нечего, кроме доступных пакетов, а там по-большей части все задокументировано. Но пока я писал примеры, я офигел как сложно пользоваться моим сервером и написал для него такой простой доступ, и все это положил прям в корень, и задокументировал.

В целом я и раньше документировал, но вот, например баги никогда не добавлял

Примеры

Я тут сделал два примера, один - сырые запросы, другой при помощи пакета-помощника. В для тестов я поднимаю сервер, сделал его в файле example_init_test.go

Значок покрытия тестами

badge

теперь в https://gist.github.com/thefrol/571cee70d9542f9f39127a69ed007706 генерируются файлы с покрытием под бранчи, нужно передать это имя в ссылку вида

https://img.shields.io/endpoint?url=<my_gist_link>

Copy link
Collaborator

@EsdeathEsdeath EsdeathEsdeath left a comment

Choose a reason for hiding this comment

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

Можно еще добавить процент покрытия тестами прямо в репе, в виде плашки, мелочь, а приятно

errorString, err := io.ReadAll(resp.Body)
if err != nil {
errorString = []byte("cant read body of response")
// видимо вот для таких случаев надо осознанно работать с ошибками
Copy link
Collaborator

Choose a reason for hiding this comment

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

Точно

Copy link
Owner Author

Choose a reason for hiding this comment

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

хехе, рад, что ты оценил

}

log.Info().Str("addr", profilerAddr).Msg("профилировщик остановлен")
}()
}

// Часть IV
// --------
//
// Тут остались деферы, и сервер будет завершен аккуратно
Copy link
Collaborator

Choose a reason for hiding this comment

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

Для этого wg.Wait не принципиально

Copy link
Owner Author

Choose a reason for hiding this comment

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

Справедливо. Я сейчас переделывать не буду. Но концептуально, да. Ничего страшного если какая-то ошибка тут будет, правда

model.go Outdated
"github.com/thefrol/kysh-kysh-meow/internal/server/app/metricas"
)

// С используется чтобы передавать
Copy link
Collaborator

Choose a reason for hiding this comment

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

Не очень нравится названия структуры, хорошо если по названию и так можно понять зачем она примерно нужно, иначе трудно будет разобраться

Copy link
Owner Author

Choose a reason for hiding this comment

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

Исправил вот тут 0f83f4e

Copy link
Owner Author

@thefrol thefrol Dec 27, 2023

Choose a reason for hiding this comment

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

В целом я просто часто такое видел как testing.T, testing.B, mongo.D и прочее. Вообще я был не в восторге, но вдруг мне понравилось. И до сих пор думаю это классная идея, как будто это какой-то очень важный тип данных, раз его одной буквой пишут)

* script: add coverage script

* cicd: add badges workflow

* cicd: change badge file

* cicd: генерировать файл по имени ветки

* cicd: правильно обмениваться между шагами данными

* cicd: покрасить бедж и вывести инфу

* cicd: поменять имя раннера

---------

Co-authored-by: Dima Frolenko <[email protected]>
@thefrol
Copy link
Owner Author

thefrol commented Dec 27, 2023

Можно еще добавить процент покрытия тестами прямо в репе, в виде плашки, мелочь, а приятно

badge

Да, хорошая идея. Жалко я не нашел способа прикрепить под конкретный бранч такой бедж, но под каждый генерирую теперь

@thefrol thefrol merged commit be9db2e into main Dec 27, 2023
5 checks passed
@thefrol thefrol deleted the iter18 branch December 27, 2023 15:07
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