Giter Site home page Giter Site logo

tour's Introduction

tour's People

Contributors

abbot avatar adg avatar alexbrainman avatar altree avatar andrewaustin avatar andybons avatar bgadrian avatar broady avatar campoy avatar chai2010 avatar dmitshur avatar dupoxy avatar katiehockman avatar kortschak avatar kytrinyx avatar mak73kur avatar martinkunc avatar mikespook avatar minux avatar mstokluska avatar nickpresta avatar rakyll avatar robphoenix avatar robpike avatar rsc avatar sajmani avatar shulhan avatar tux21b avatar ykzts avatar zorion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tour's Issues

Exercise: Slices (moretypes/18) sometimes only renders part of the image

I followed the instructions in Go Offline (https://tour.golang.org/welcome/3) and ran the tour tool with go tool tour. On the lesson Exercise: Slices, when I provide the following code, only about 30% of the image renders.

package main

import "golang.org/x/tour/pic"

func Pic(dx, dy int) [][]uint8 {
    var img [][]uint8
    img = make([][]uint8, dy)
    for y := range img {
        img[y] = make([]uint8, dx)
        for x := range img[y] {
            img[y][x] = uint8(((x*x)^(y*y))/2)
        }
    }
    return img
}

func main() {
    pic.Show(Pic)
}

The image is followed by a really long string (46,138 characters!).

It seems like this might be related to how long it takes to render the image. If I change the line img[y][x] = uint8(((x*x)^(y*y))/2) to img[y][x] = uint8(((x*x)^(y*y))), for example, sometimes about 75% of the image renders, and sometimes 100% of the image renders. When the entire image renders, the long string does not appear. In both cases Program exited. is printed at the very bottom.

If I change the pixel equation to img[y][x] = uint8(x^y), it seems to always finish rendering.

This problem does not occur in the online tour (https://tour.golang.org/moretypes/18); just the offline one running on my workstation.

tour: can't import pic program from provided address

Context: https://tour.golang.org/moretypes/18

import golang.org/x/tour/pic attemps to import the function from either $GOROOT or $GOPATH which results in the following error:

cannot find package "golang.org/x/tour/pic" in any of:
C:\Go\src\golang.org\x\tour\pic (from $GOROOT)
C:\Gocode\src\golang.org\x\tour\pic (from $GOPATH)

Apparently, the function resides in C:\Go\misc\tour\src\golang.org\x\tour\pic so the import has an incorrect address.

Edit: apparently I had to go get golang.org/x/tour/pic to get the import working.

tour: output shows Google first and Bell Labs second

Context: https://tour.golang.org/moretypes/21

Change the title above to describe your issue and add your feedback here, including code if necessary

Hi, why does the output of the map-literals-continued.go show "Google" is the first element, and "Bell Labs" the second?

map[Google:{37.42202 -122.08408} Bell Labs:{40.68433 -74.39967}]
with Vertex the type omitted.

It's different from my laptop, which shows:
map[Bell Labs:{40.68433 -74.39967} Google:{37.42202 -122.08408}]

In map-literals.go, your code shows
map[Bell Labs:{40.68433 -74.39967} Google:{37.42202 -122.08408}]
with Vertex as the type shown in the code.

Dwight

tour: New array? What about garbage collection?

Context: https://tour.golang.org/moretypes/15

If the backing array of s is too small to fit all the given values a bigger array will be allocated. The returned slice will point to the newly allocated array.

It would be useful to understand at what cost this newly created array would be. How does Go handle garbage collection is situations like this? What happens to the old array?

This might be outside of the scope of a tutorial, but I would find a sentence or two on what happens to the old array useful.

Cheers!

tour: Table of contents - dock right

Would it be possible to make the "Table of contents" pane dock right? It disappears when you click on the code area. It would be nice if it stays open for easy navigation.

Thanks

tour: Incorrect slicing behaviour on local AND remote gotour

Context: http://127.0.0.1:3999/moretypes/10

given s := []int{2, 3, 5, 7, 11, 13}, s[1:4] gives [3 5 7]. This is correct. However, s[:4] gives [3 5 7 11] this is clearly incorrect. Here is the complete code:

package main

import "fmt"

func main() {
    s := []int{2, 3, 5, 7, 11, 13}

    s = s[1:4]
    fmt.Println(s)

    s = s[:4]
    fmt.Println(s)
}

and the output:

[3 5 7]
[3 5 7 11]

Program exited.

The same behavior is present at https://tour.golang.org/moretypes/10

tour: Go Tour slice explanation is confusing

Context: http://tour.golang.org/moretypes/7

Open from internal bug

I was going through the Go Tour and got to your explanation of slices: http://tour.golang.org/moretypes/7
It says, "A slice points to an array of values and also includes a length." That makes it sounds like a Slice is an Array with a length value – which I'm pretty sure is wrong. Arrays' types have lengths and slices' don't have lengths (see http://blog.golang.org/go-slices-usage-and-internals which says "Unlike an array type, a slice type has no specified length.")

Apologies if 1) I'm just misunderstanding – entirely possible – or 2) this is the wrong component to file the bug

Steps to reproduce:

  1. review the explanation of slices in the Go Tour: http://tour.golang.org/moretypes/7
  2. compare to the explanation in your blog post: http://blog.golang.org/go-slices-usage-and-internals

tour: rand.Seed suggestion does not work

Context: https://tour.golang.org/basics/1

I wanted to get a different number each time from this example, so I took the suggestion to seed the number generator.

Here is my code:

package main

import (
    "fmt"
    "math/rand"
    "time"
)

func main() {
    rand.Seed(time.Now().UTC().UnixNano())
    fmt.Println("My favorite number is", rand.Intn(9001))
}

When I execute the above code in the tour, the same number is returned every time as if seeding the number generator has no effect.

When I execute this code locally (go version go1.6.2 darwin/amd64) it returns a different number each time as expected.

tour: [We need to print Interface-float-var.Abs()]

Context: https://tour.golang.org/methods/9

Since, both the variables f & v of different types, implement the Abser interface, I think it would be good to print f.Abs() too to the console, to make the user understand how 2 different values are printed, due to 2 different methods specific to their respective type.

Change would be to add,
fmt.Println(f.Abs()) at the end of the main function.

tour: Issues when using append

Hello expert:
When go through the golang tour, I encounter an issue that confused me, could you please help to explain?
The scenarios could be: I have a original array (names), and copy partial data to slice (a), then I add additional data to slice (a), then the original array is affected. Please note that I use additional value to append to splice, I wonder why the original array are affected, many thanks for your answer!

Best Regards
Chengchang

Context: https://tour.golang.org/moretypes/8

package main
import "fmt"
func main() {
    names := [4]string{
        "John",
        "Paul",
        "George",
        "Ringo",
    }
    fmt.Println(names)

    a := names[0:3]
    fmt.Println(a)

    add := "xxxx"
    a = append(a, add)

    fmt.Println(a)
    fmt.Println(names)
}

tour: [interfaces]

Context: https://tour.golang.org/methods/9

The incorrect comment on this page is actually on line 18.

so change

Note: There is an error in the example code on line 22. Vertex (the value type) doesn't implement Abser because the Abs method is defined only on *Vertex (the pointer type).

to

Note: There is an error in the example code on line 18. Vertex (the value type) doesn't implement Abser because the Abs method is defined only on *Vertex (the pointer type).

tour: Improve concurrency example

Context: https://tour.golang.org/concurrency/5

It took me a bit of time to understand what was going on on this step.

Until I realized that the go func() was actually waiting for the Fibonacci sequence function to send information to the channel, and was also stopping it by sending something into quit.

I simply added some print to figure this out, but I guess it might be worth improving the description or code snippet.

tour: Output doesn't work

Context: https://tour.golang.org/methods/23

I've solved methods/23 like this:

func (old_reader rot13Reader) Read(b []byte) (int, error) {
    const LEN int = 1024
    tmp_bytes := make([]byte, LEN)
    old_len, err := old_reader.r.Read(tmp_bytes)
    if err == nil {
        tmp_bytes = tmp_bytes[:old_len]
        rot13(tmp_bytes)
        return len(tmp_bytes), nil
    } else {
        return 0, err
    }
}

func main() {
    s := strings.NewReader("Lbh penpxrq gur pbqr!")
    r := rot13Reader{s}
    io.Copy(os.Stdout, &r)
}

where rot13 is correct, but I can't see any output, process just exits. Debug output just before return len(tmp_bytes), nil shows correct string.

tour: favicon link broken

Current favicon link is broken and returns 404. This is not a first world problem but I wanted to report it and propose a fix.

tour: slice of slices

Context: https://tour.golang.org/moretypes/15 about slice of slices

Samples do not compile (it is maybe the exercise ?)
Slice of slices are authorized by specifications but are more complex to initialize.
Append does not work on an empty slice of slice.
If init is set with 1 element like board := [1][]int then append will work on board[0]
Another solution is to add slice notation to the added element and not the basic type element (0).

In example 15, printSlice cannot work if argument is not set to (s [][]int).

Could you confirm that slice of slices is supported ?
If yes, sample should look like this unless errors are the exercise.
`package main

import "fmt"

func main() {
var s [][]int
printSlice(s)

// append works on nil slices.
s = append(s, []int{0,})
printSlice(s)

// The slice grows as needed.
s[0] = append(s[0], 1)
printSlice(s)

// We can add more than one element at a time.
s[0] = append(s[0], 2, 3, 4)
s = append(s,  []int{2, 3, 4,}) //or add a separate slice
printSlice(s)

}

func printSlice(s [][]int) {
fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s)
}`

tour: appears remote server is not responding when using Traditional Chinese — 中文(繁體

Context: https://tour.golang.org/welcome/2

it seems the remote server is not responding when using language translation :

    Traditional Chinese — 中文(繁體)

which take you to link

    https://go-tour-zh-tw.appspot.com/#1

When expecting an answer after hitting RUN its response UI text area flashes then goes blank when it should show result of Run ... other language translations seem OK

Interestingly, I am on the Opera browser and after above happened my opera sync became disconnected for the very first time ...

tour: local tour instructions incomplete

Context: https://tour.golang.org/welcome/3

The instructions suggest that downloading and installing Go allows the user to run the tour locally, but they do not mention that Go Tour project must also be installed.

Perhaps suggesting installation of Go and Go Tour with a link to the Go Tour project README for their installation and execution instructions would be helpful for folks wanting to run the tour locally.

tour: [Initialize an array by a default value]

Like an array of size 100 filled with value -1 in C++.
eg: std::fill_n(array, 100, -1);

The same thing I want to do in Go.

array := make([]int, 100)

how to fill it with -1 in one line?

RFE: Tab Complete

Would be super awesome if users could tab complete or get a description of what the functions are actually doing.

Running though some of these examples, I'm fluxing with the examples and curious to see what else is supposed with these imported libraries.

Something similar to how ipython does it would be utterly fantastic!

tour: foreign versions broken or unavailable

I notice the french version of Golang Tour returns empty response when executing code. I try other languages and found other "broken" versions:

What did you do?

Run Hello.go

What did you expect to see?

A correct output :

Hello, 世界

Program exited.

What did you see instead?

An empty response:

Program exited.

Summary

Language Code execution Available
Brazilian Portuguese — Português do Brasil ok ok
Catalan — Català ok ok
German — Deutsch FAIL ok
Spanish — Español ok ok
French — Français FAIL ok
Indonesia — Bahasa ok ok
Italian — Italiano ok ok
Hebrew — עִבְרִית ok ok
Japanese — 日本語 ok ok
Korean — 한국어 ok ok
Romanian — Română ok ok
Simplified Chinese — 中文(简体) ok ok
Traditional Chinese — 中文(繁體) ok ok
Ukrainian — Українська FAIL ok
Uzbek — Ўзбекча FAIL ok
Turkish - Türkçe FAIL FAIL

The turkish domain isn't resolving.

Premature reference to %T and %v adversely impacts the understanding

https://tour.golang.org/basics/11

Title: Basic type

func main() {
    const f = "%T(%v)\n"
    fmt.Printf(f, ToBe, ToBe)
    fmt.Printf(f, MaxInt, MaxInt)
    fmt.Printf(f, z, z)
}

Here the value assigned to const f is very confusing. There has been no reference to %T and %v prior to this.

I spent a long time wondering what the output implied.

Could we have a string as simple as " Type : %T , Value : %v \n " instead of "%T(%v)\n" for the sake of better understanding and readability.

I could open a PR for this right away.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.