Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3130)

Issue 11407043: code review 11407043: go.talks: Best Practices in Go (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by francesc
Modified:
10 years, 9 months ago
Reviewers:
adg
CC:
adg, campoy, golang-dev
Visibility:
Public.

Description

go.talks: Best Practices in Go

Patch Set 1 #

Patch Set 2 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Patch Set 3 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Total comments: 46

Patch Set 4 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Patch Set 5 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Total comments: 4

Patch Set 6 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Total comments: 28

Patch Set 7 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Patch Set 8 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Total comments: 14

Patch Set 9 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Patch Set 10 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Patch Set 11 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Patch Set 12 : diff -r 9b0d52b06893 https://code.google.com/p/go.talks #

Patch Set 13 : diff -r fd499995c0fa https://code.google.com/p/go.talks #

Unified diffs Side-by-side diffs Delta from patch set Stats (+997 lines, -0 lines) Patch
A 2013/bestpractices.slide View 1 2 3 4 5 6 7 8 9 10 1 chunk +270 lines, -0 lines 0 comments Download
A 2013/bestpractices/bufchan.go View 1 2 3 4 5 6 1 chunk +50 lines, -0 lines 0 comments Download
A 2013/bestpractices/bufchanfix.go View 1 2 3 4 5 6 1 chunk +50 lines, -0 lines 0 comments Download
A 2013/bestpractices/cmd.png View 1 2 3 4 5 6 Binary file 0 comments Download
A 2013/bestpractices/concurrency1.go View 1 1 chunk +32 lines, -0 lines 0 comments Download
A 2013/bestpractices/concurrency2.go View 1 1 chunk +32 lines, -0 lines 0 comments Download
A 2013/bestpractices/funcdraw/cmd/funcdraw.go View 1 2 3 4 5 6 1 chunk +48 lines, -0 lines 0 comments Download
A 2013/bestpractices/funcdraw/drawer/dependent.go View 1 2 3 4 5 6 1 chunk +14 lines, -0 lines 0 comments Download
A 2013/bestpractices/funcdraw/drawer/drawer.go View 1 2 3 4 5 6 1 chunk +15 lines, -0 lines 0 comments Download
A 2013/bestpractices/funcdraw/drawer/drawer_test.go View 1 2 3 4 5 6 1 chunk +22 lines, -0 lines 0 comments Download
A 2013/bestpractices/funcdraw/parser/parser.go View 1 2 3 4 5 6 1 chunk +23 lines, -0 lines 0 comments Download
A 2013/bestpractices/httphandler.go View 1 2 3 4 5 1 chunk +59 lines, -0 lines 0 comments Download
A 2013/bestpractices/quitchan.go View 1 2 3 4 5 6 1 chunk +58 lines, -0 lines 0 comments Download
A 2013/bestpractices/server.go View 1 1 chunk +44 lines, -0 lines 0 comments Download
A 2013/bestpractices/shortercode1.go View 1 2 3 4 5 6 7 8 9 1 chunk +59 lines, -0 lines 0 comments Download
A 2013/bestpractices/shortercode2.go View 1 2 3 4 1 chunk +47 lines, -0 lines 0 comments Download
A 2013/bestpractices/shortercode3.go View 1 2 3 4 1 chunk +55 lines, -0 lines 0 comments Download
A 2013/bestpractices/shortercode4.go View 1 2 3 4 5 6 7 8 9 1 chunk +60 lines, -0 lines 0 comments Download
A 2013/bestpractices/shortercode5.go View 1 2 3 4 5 6 7 8 9 1 chunk +59 lines, -0 lines 0 comments Download

Messages

Total messages: 12
francesc
Hello adg@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go.talks
10 years, 9 months ago (2013-07-17 03:25:10 UTC) #1
adg
https://codereview.appspot.com/11407043/diff/6001/2013/bestpractices.slide File 2013/bestpractices.slide (right): https://codereview.appspot.com/11407043/diff/6001/2013/bestpractices.slide#newcode10 2013/bestpractices.slide:10: From Wikipedia: this and the next slide would be ...
10 years, 9 months ago (2013-07-17 10:50:09 UTC) #2
francesc
PTAL https://codereview.appspot.com/11407043/diff/6001/2013/bestpractices.slide File 2013/bestpractices.slide (right): https://codereview.appspot.com/11407043/diff/6001/2013/bestpractices.slide#newcode10 2013/bestpractices.slide:10: From Wikipedia: On 2013/07/17 10:50:09, adg wrote: > ...
10 years, 9 months ago (2013-07-17 22:22:02 UTC) #3
campoy
On 2013/07/17 22:22:02, gocampoy wrote: > PTAL > > https://codereview.appspot.com/11407043/diff/6001/2013/bestpractices.slide > File 2013/bestpractices.slide (right): > ...
10 years, 9 months ago (2013-07-23 06:29:32 UTC) #4
adg
https://codereview.appspot.com/11407043/diff/13001/2013/bestpractices.slide File 2013/bestpractices.slide (right): https://codereview.appspot.com/11407043/diff/13001/2013/bestpractices.slide#newcode10 2013/bestpractices.slide:10: From Wikipedia: drop the wikipedia quote. it's a terrible ...
10 years, 9 months ago (2013-07-23 07:45:03 UTC) #5
campoy
PTAL https://codereview.appspot.com/11407043/diff/22001/2013/bestpractices.slide File 2013/bestpractices.slide (right): https://codereview.appspot.com/11407043/diff/22001/2013/bestpractices.slide#newcode38 2013/bestpractices.slide:38: Deploy one-off utility types for simpler code On ...
10 years, 9 months ago (2013-07-23 23:37:16 UTC) #6
adg
https://codereview.appspot.com/11407043/diff/33001/2013/bestpractices.slide File 2013/bestpractices.slide (right): https://codereview.appspot.com/11407043/diff/33001/2013/bestpractices.slide#newcode160 2013/bestpractices.slide:160: Constants, variables, and helper functions and types. I would ...
10 years, 9 months ago (2013-07-24 01:46:19 UTC) #7
campoy
https://codereview.appspot.com/11407043/diff/33001/2013/bestpractices.slide File 2013/bestpractices.slide (right): https://codereview.appspot.com/11407043/diff/33001/2013/bestpractices.slide#newcode160 2013/bestpractices.slide:160: Constants, variables, and helper functions and types. On 2013/07/24 ...
10 years, 9 months ago (2013-07-24 18:30:05 UTC) #8
campoy
On 2013/07/24 18:30:05, campoy wrote: > https://codereview.appspot.com/11407043/diff/33001/2013/bestpractices.slide > File 2013/bestpractices.slide (right): > > https://codereview.appspot.com/11407043/diff/33001/2013/bestpractices.slide#newcode160 > ...
10 years, 9 months ago (2013-07-24 23:44:03 UTC) #9
adg
LGTM
10 years, 9 months ago (2013-07-24 23:47:06 UTC) #10
francesc
*** Submitted as https://code.google.com/p/go/source/detail?r=dd84e6e4aecd&repo=talks *** go.talks: Best Practices in Go R=adg, campoy CC=golang-dev https://codereview.appspot.com/11407043
10 years, 9 months ago (2013-07-24 23:49:44 UTC) #11
campoy
10 years, 9 months ago (2013-07-26 21:19:11 UTC) #12
Hi Christoph,

My code wasn't intended to be safe in the case of multiple concurrent calls
to stop, it's something I knew.

And yes, I agree that your solution fixes it :-) Nice job!

 Francesc Campoy Flores | Go Developer Relations | campoy@google.com |
 415-990-4126


On Wed, Jul 24, 2013 at 6:24 PM, Christoph Hack <christoph@tux21b.org>wrote:

> Sorry for yet another mail, but I think I have found a cleaner solution
> based on sync.Once. I am happy now with this approach:
> http://play.golang.org/p/KAn1Y8uczj
>
> Am Donnerstag, 25. Juli 2013 02:54:57 UTC+2 schrieb Christoph Hack:
>
>> The "Use goroutines to manage state" example code looks a bit racy to me.
>> The Stop method must not be called concurrently or otherwise clients might
>> either observe a stopped state before the server was shut down properly or
>> they may block indefinitely if someone else stopped the server before. I am
>> guessing that's not the intended behavior, since the whole purpose of the
>> dedicated server goroutine is to allow concurrent access, isn't it?
>>
>>
http://play.golang.org/p/**l9s7SZZBJb<http://play.golang.org/p/l9s7SZZBJb>should
fix the problem, but I am not sure if I would consider it best
>> practice. Does anyone know a simpler solution to this common problem?
>>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b