gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.
MIT License
3.85k stars 264 forks source link

repl.go:4:1: package rand "math/rand" has no symbol Shuffle #154

Closed dfang closed 5 years ago

dfang commented 5 years ago
import "fmt"
import "strings"
import "math"
import "math/rand"

words := strings.Fields("ink runs from the corners of my mouth")
rand.Shuffle(len(words), func(i, j int) {
    words[i], words[j] = words[j], words[i]
})
fmt.Println(words)

returns repl.go:4:1: package rand "math/rand" has no symbol Shuffle

cosmos72 commented 5 years ago

Hello @dfang, yes, it's missing. Gophernotes keeps compatibility with go 1.9, which does not have rand.Shuffle - it was introduced in go 1.10.

I added a lot of conditional compile to import go 1.11 symbols when compiling with go 1.11 or later, but: 1) it does yet not include "math/rand" 2) it only recognizes go 1.11 or later, not go 1.0

If you use go 1.11+, I should be able to solve this soon

cosmos72 commented 5 years ago

fixed in a74a5411a5edbacdc582e0982cf33ea8d6d12273