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

Example on main page isn't valid Go #56

Closed
bradfitz opened this issue Jun 16, 2018 · 3 comments · Fixed by #71
Closed

Example on main page isn't valid Go #56

bradfitz opened this issue Jun 16, 2018 · 3 comments · Fixed by #71

Comments

@bradfitz
Copy link

https://github.com/ceph/go-ceph#object-io has the code:

// write some data
bytes_in := []byte("input data")
err = ioctx.Write("obj", bytes_in, 0)

// read the data back out
bytes_out := make([]byte, len(bytes_in))
n_out, err := ioctx.Read("obj", bytes_out, 0)

if bytes_in != bytes_out {
    fmt.Println("Output is not input!")
}

But that final comparison isn't valid Go. You can only compare a slice to nil, not to other slices.

So that example wouldn't even compile.

(Lesser nit: Go doesn't use underscores in variable names, so idiomatic Go would be bytesIn and bytesOut)

@ghost
Copy link

ghost commented Aug 1, 2018

i noticed the same problem

@dotnwat
Copy link
Contributor

dotnwat commented Aug 1, 2018

Thanks. I'll be pushing a big update in a the next week or two and will resolve this.

@MalloZup
Copy link
Contributor

MalloZup commented Oct 7, 2018

@bradfitz @noahdesu jfyi ^^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants