rivo / uniseg

Unicode Text Segmentation, Word Wrapping, and String Width Calculation in Go
MIT License
570 stars 60 forks source link

Issue #56

Closed d0nte5 closed 1 month ago

d0nte5 commented 1 month ago

└─$ go run main.go

github.com/rivo/uniseg

../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:137:20: error: expected ‘(’ 137 | func propertySearch[E interface{ [3]int | [4]int }](dictionary []E, r rune) (result E) { | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:137:23: error: expected ‘]’ 137 | func propertySearch[E interface{ [3]int | [4]int }](dictionary []E, r rune) (result E) { | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:137:23: error: expected ‘;’ or newline after top level declaration ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:140:9: error: expected declaration 140 | to := len(dictionary) | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:141:9: error: expected declaration 141 | for to > from { | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:143:17: error: expected declaration 143 | cpRange := dictionary[middle] | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:144:17: error: expected declaration 144 | if int(r) < cpRange[0] { | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:146:25: error: expected declaration 146 | continue | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:147:17: error: expected declaration 147 | } | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:148:17: error: expected declaration 148 | if int(r) > cpRange[1] { | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:150:25: error: expected declaration 150 | continue | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:151:17: error: expected declaration 151 | } | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:152:17: error: expected declaration 152 | return cpRange | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:153:9: error: expected declaration 153 | } | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:154:9: error: expected declaration 154 | return | ^ ../../../go/pkg/mod/github.com/rivo/uniseg@v0.4.7/properties.go:155:1: error: expected declaration 155 | }

rivo commented 1 month ago

Make sure you're using at least Go v1.18:

https://github.com/rivo/uniseg/blob/087b3e4194c1feb0856b68d0e7c425c0994829cf/go.mod#L3

d0nte5 commented 1 month ago

go version go version go1.18 gccgo (Debian 14-20240201-3) 14.0.1 20240131 (experimental) [master r14-8680-g2f14c0dbb78] linux/amd64

Despite using the latest version of Go, I still encountered the same error.

rivo commented 1 month ago

GCC does not yet include support for generics.

Please use the official Go compiler. The latest version there is 1.22.3.