This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Подготовительная программа на С/С++ | |
[Описание курса](https://park.mail.ru/curriculum/program/discipline/532/) | |
## Критерии качества выполнения и оценки домашнего задания | |
За задание можно получить не более 10 баллов. | |
**Рабочая программа** - 4 балла. | |
**Valgrind, Mtrace, любая другая утилита, показывающая отсутствие утечек памяти** - 2 балла: | |
```bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package redistracing | |
import ( | |
"context" | |
"fmt" | |
"strings" | |
"github.com/go-redis/redis/v7" | |
"github.com/opentracing/opentracing-go" | |
"github.com/opentracing/opentracing-go/ext" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"github.com/gin-gonic/gin" | |
"github.com/prometheus/client_golang/prometheus/promhttp" | |
) | |
// ... | |
{ | |
r := gin.New() | |
r.GET("/metrics", func() gin.HandlerFunc { | |
h := promhttp.Handler() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var validPhoneNumber = regexp.MustCompile(`^(\+7|8) \(\d{3}\) \d{7}$`) | |
// SimplifyPhoneNumber transform "+7 (909) 9316826" (or "8 (909) 9316826") to "9099316826" | |
func SimplifyPhoneNumber(number string) (string, error) { | |
if !validPhoneNumber.MatchString(number) { | |
return "", fmt.Errorf("invalid phone number format: %s", number) | |
} | |
if len(number) == 15 { | |
return number[3:6] + number[8:], nil | |
} |