а так заработает?

This commit is contained in:
B4D_US3R 2025-05-20 12:23:24 +05:00
parent 2dee2f05e1
commit 7118b990e6
5 changed files with 16 additions and 14 deletions

13
v2/add.go Normal file
View file

@ -0,0 +1,13 @@
// Пакет, складывающий два числа
package testmod
import "golang.org/x/exp/constraints"
type Number interface {
constraints.Integer | constraints.Float
}
// Функция, складывающая два числа
func Add[T Number](a T, b T) T {
return a + b
}

5
v2/go.mod Normal file
View file

@ -0,0 +1,5 @@
module git.catgirls.asia/B4D_US3R/testmod
go 1.23.1
require golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6

2
v2/go.sum Normal file
View file

@ -0,0 +1,2 @@
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI=
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=