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

x/text/unicode/norm: Last slice returned by Iter.Next() is empty. #20710

Closed
overcyn opened this issue Jun 16, 2017 · 1 comment
Closed

x/text/unicode/norm: Last slice returned by Iter.Next() is empty. #20710

overcyn opened this issue Jun 16, 2017 · 1 comment
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@overcyn
Copy link

overcyn commented Jun 16, 2017

What version of Go are you using (go version)?

go version go1.8.3 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/Overcyn/Workspace/go/"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/c3/8xb38pfj2kvg1c87nfdq8h140000gn/T/go-build823422639=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

package main

import (
	"fmt"
	"golang.org/x/text/unicode/norm"
)

func main() {
	in := []byte("test")
	fmt.Println("Init()", in)

	var it norm.Iter
	it.Init(norm.NFD, in)
	for !it.Done() {
		fmt.Println(it.Next(), it.Pos())
	}

	fmt.Println("InitString()", string(in))

	var it2 norm.Iter
	it2.InitString(norm.NFD, string(in))
	for !it2.Done() {
		fmt.Println(it2.Next(), it2.Pos())
	}
}

What did you expect to see?

I expect that Iter to iterate over the entire byte slice.

What did you see instead?

The last slice returned by Iter.Next is empty. Iter.InitString returns the expected values.

Init() [116 101 115 116]
[116] 1
[101] 2
[115] 3
[] 4
InitString() test
[116] 1
[101] 2
[115] 3
[116] 4
@bradfitz bradfitz changed the title /x/text/unicode/norm: Last slice returned by Iter.Next() is empty. x/text/unicode/norm: Last slice returned by Iter.Next() is empty. Jun 16, 2017
@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 11, 2018
@andybons andybons added this to the Unreleased milestone Apr 11, 2018
@gopherbot
Copy link

Change https://golang.org/cl/145559 mentions this issue: unicode/norm: bug fix in Iter

@golang golang locked and limited conversation to collaborators Oct 30, 2019
@rsc rsc unassigned mpvl Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants