golang,括号周围的奇怪错误或返回

func isPrimeNumber(possiblePrime int) bool {
    for underPrime := 2; underPrime < possiblePrime; underPrime++ {
        if possiblePrime%underPrime == 0 {
            return false
        }
    }
    return true
}


func findPrimeNumbers(channel chan int) {
    for i := 2; ; /* infinite loop */ i++ {
        // your code goes here
        if isPrimeNumber(i){
            chan <- i     <========error on this line
        }
        assert(i < 100) // i is afraid of heights
    }
}

I got error on this but could not figure it out, need help. thanks

syntax error: unexpected semicolon or newline, expecting { FAIL

Use channel <- i instead of chan <- i.

In you function definition (channel chan int), channel is parameter's name, and chan int is the type. To clarify, your function could be rewrote to the following one:

func findPrimeNumbers(primeNumberChannel chan int) {
    for i := 2; ; i++ {
        if isPrimeNumber(i){
            primeNumberChannel <- i  
        }
    }
}

Additionally, assert is not available in Go (http://golang.org/doc/faq#assertions).