rivo / uniseg

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

properties.go err #41

Closed karoenven closed 11 months ago

karoenven commented 11 months ago

Hi,I got a problem compiling my ngrok program, which relies on this uniseg but has generated an error. I checked the local properties. go and the remote one are consistent. What should I do?

karoenven commented 11 months ago

sudo make release-client bin/go-bindata -nomemcopy -pkg=assets -tags=release \ -debug=false \ -o=src/ngrok/client/assets/assets_release.go \ assets/client/... bin/go-bindata -nomemcopy -pkg=assets -tags=release \ -debug=false \ -o=src/ngrok/server/assets/assets_release.go \ assets/server/... go get -tags 'release' -d -v ngrok/... go install -tags 'release' ngrok/main/ngrok

github.com/rivo/uniseg

src/github.com/rivo/uniseg/properties.go:137:6: missing function body src/github.com/rivo/uniseg/properties.go:137:20: syntax error: unexpected [, expecting ( Makefile:17: recipe for target 'client' failed make: *** [client] Error 2

karoenven commented 11 months ago

it doesn't run right . // propertySearch performs a binary search on a property slice and returns the // entry whose range (start = first array element, end = second array element) // includes r, or an array of 0's if no such entry was found. func propertySearch[E interface{ [3]int | [4]int }](dictionary []E, r rune) (result E) { // Run a binary search. from := 0 to := len(dictionary) for to > from { middle := (from + to) / 2 cpRange := dictionary[middle] if int(r) < cpRange[0] { to = middle continue } if int(r) > cpRange[1] { from = middle + 1 continue } return cpRange } return }

// property returns the Unicode property value (see constants above) of the // given code point. func property(dictionary [][3]int, r rune) int { return propertySearch(dictionary, r)[2] }

rivo commented 11 months ago

Looks like you're using an old Go version. uniseg requires at least Go v1.18. (The current Go version is v1.20.6.)

karoenven commented 11 months ago

Looks like you're using an old Go version. uniseg requires at least Go v1.18. (The current Go version is v1.20.6.) yes,I first use go1.10,it doesn't work, change it to go1.18. it is ok