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

golan #21927

Closed
swissknife007 opened this issue Sep 18, 2017 · 4 comments
Closed

golan #21927

swissknife007 opened this issue Sep 18, 2017 · 4 comments

Comments

@swissknife007
Copy link

Please answer these questions before submitting your issue. Thanks!

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

Does this issue reproduce with the latest release? Yes

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go-1.7"
GOTOOLDIR="/usr/lib/go-1.7/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build279210773=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

package main

import (
"fmt"
)

func main() {
fmt.Println("Hello, playground")
hello := make(chan int)

    go func() {
	hello <- 1
}()	

    go f(){
    	//hello <- 2
    }() 
hello_value := <- hello
fmt.Println(hello_value)

}

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

The code should have compiled.

What did you see instead?

Compilation error.

@swissknife007
Copy link
Author

package main

import (
"fmt"
)

func main() {
fmt.Println("Hello, playground")
hello := make(chan int)

    go func() {
	hello <- 1
}()	

    go f(){
    	//hello <- 2
    }() 
hello_value := <- hello
fmt.Println(hello_value)

}

@davecheney
Copy link
Contributor

We don't the issue tracker to ask questions. Please see https://golang.org/wiki/Questions for good places to ask. Thanks.

@swissknife007
Copy link
Author

swissknife007 commented Sep 18, 2017 via email

@cespare
Copy link
Contributor

cespare commented Sep 18, 2017

It should be go func() {, not go f(){. The error message indicates the site of the problem.

@golang golang locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants