Skip to content

Wasm only compile error: function is already defined:internal/bytealg.CountString #699

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

Closed
justinclift opened this issue Nov 6, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@justinclift
Copy link
Member

justinclift commented Nov 6, 2019

With current TinyGo dev branch, using strings.Split() causes a compile failure when compiling to wasm:

$ tinygo build -target wasm -o foo main.go
../../../../../../../usr/local/go/src/internal/bytealg/count_generic.go:19:6: function is already defined:internal/bytealg.CountString
$ go version
go version go1.13.4 linux/amd64

The compile failure only happens when the target is wasm. Without -target wasm, the compilation will succeed.

A minimal 100% reproducer:

package main

import (
	"strings"
)

func main() {
	s := strings.Split("An example string", "\n")
	println(len(s))
}
@justinclift justinclift added the bug Something isn't working label Nov 6, 2019
justinclift added a commit to justinclift/stl that referenced this issue Nov 6, 2019
To work around TinyGo bug 699:

  tinygo-org/tinygo#699

Completely untested, may not even work. ;)
@justinclift
Copy link
Member Author

That reproducer also fails when run in the TinyGo playground, so it's not just me (wasn't sure). 😄

@aykevl
Copy link
Member

aykevl commented Nov 10, 2019

I think this problem was introduced with the following PR: #424

@justinclift
Copy link
Member Author

Thanks @aykevl, #424 did fix this. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants