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

tour: figure out how to make pic.Show interact well with debug prints #14206

Open
doublek opened this issue Feb 3, 2016 · 4 comments

Comments

@doublek
Copy link

commented Feb 3, 2016

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

Running the slices exercise doesn't display bluescale image. Instead it displays the slices of slices returned by Pic and as the last line prints "IMAGE: ".

@bradfitz bradfitz added this to the Unreleased milestone Feb 3, 2016

@adg

This comment has been minimized.

Copy link
Contributor

commented Feb 4, 2016

Are you able to provide a sample program that reproduces this issue? My trivial solution seems to work ok:

package main

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

func Pic(dx, dy int) [][]uint8 {
    m := make([][]uint8, dy)
    for i := range m {
        m[i] = make([]uint8, dx)
    }
    return m
}

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

This comment has been minimized.

Copy link
Author

commented Feb 10, 2016

I tried running my bit of code again, it turned out that I was debug printing some intermediate values and this was preventing the image from showing up. Removing the print made the image show up. This issue can be closed if this behavior is okay.

@adg

This comment has been minimized.

Copy link
Contributor

commented Feb 10, 2016

We should probably figure out a more graceful way of handling intermingling
of image data and debug prints. Yours wouldn't have been the only example.

On 10 February 2016 at 16:17, Karthik Krishnan Ramasubramanian <
notifications@github.com> wrote:

I tried running my bit of code again, it turned out that I was debug
printing some intermediate values and this was preventing the image from
showing up. Removing the print made the image show up. This issue can be
closed if this behavior is okay.


Reply to this email directly or view it on GitHub
#14206 (comment).

@adg adg changed the title tour: Running exercise-slices does not display "bluescale" image tour: figure out how to make pic.Show interact well with debug prints Mar 21, 2016

@adg adg removed their assignment May 27, 2016

@agnivade

This comment has been minimized.

Copy link
Member

commented Oct 4, 2017

Hi @doublek - Can you mention what are the debug statements that you added that was preventing the image from being shown ? A code example would be really appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.