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

Issue 186130: code review 186130: Tweaked the getDisplay function so, that the x11 packag...

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 3 months ago by jhh
Modified:
14 years, 3 months ago
Reviewers:
nigeltao
CC:
golang-dev
Visibility:
Public.

Description

Tweaked the getDisplay function so, that the x11 package works on OS X when x11 is installed.

Patch Set 1 #

Patch Set 2 : code review 186130: Tweaked the getDisplay function so, that the x11 packag... #

Patch Set 3 : code review 186130: Tweaked the getDisplay function so, that the x11 packag... #

Total comments: 2

Patch Set 4 : code review 186130: Tweaked the getDisplay function so, that the x11 packag... #

Patch Set 5 : code review 186130: Tweaked the getDisplay function so, that the x11 packag... #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -12 lines) Patch
M src/pkg/exp/draw/x11/auth.go View 1 2 3 4 3 chunks +47 lines, -8 lines 3 comments Download
M src/pkg/exp/draw/x11/conn.go View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 6
jhh
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 3 months ago (2010-01-13 15:30:32 UTC) #1
nigeltao
http://codereview.appspot.com/186130/diff/1003/1004 File src/pkg/exp/draw/x11/auth.go (right): http://codereview.appspot.com/186130/diff/1003/1004#newcode14 src/pkg/exp/draw/x11/auth.go:14: // Reads the DISPLAY environment variable, and returns ("12", ...
14 years, 3 months ago (2010-01-14 12:28:59 UTC) #2
jhh
http://codereview.appspot.com/186130/diff/1003/1004 File src/pkg/exp/draw/x11/auth.go (right): http://codereview.appspot.com/186130/diff/1003/1004#newcode14 src/pkg/exp/draw/x11/auth.go:14: // Reads the DISPLAY environment variable, and returns ("12", ...
14 years, 3 months ago (2010-01-14 12:47:54 UTC) #3
jhh
PTAL
14 years, 3 months ago (2010-01-14 21:45:30 UTC) #4
rsc
14 years, 3 months ago (2010-01-15 22:06:50 UTC) #5
nigeltao
14 years, 3 months ago (2010-01-18 12:51:35 UTC) #6
http://codereview.appspot.com/186130/diff/1010/1011
File src/pkg/exp/draw/x11/auth.go (right):

http://codereview.appspot.com/186130/diff/1010/1011#newcode17
src/pkg/exp/draw/x11/auth.go:17: // If a path is missing (like in ":12.0") the
default "/tmp/.X11-unix/X" is used.
I think it would help if the doc comment had examples of the different DISPLAY
formats it could handle, and what the resultant (network, raddr, display) was.
For example:
:1.0
/tmp/launch-123456/:0
hostname:2.0

http://codereview.appspot.com/186130/diff/1010/1011#newcode26
src/pkg/exp/draw/x11/auth.go:26: if d[0] != ':' {
I think you can switch on d[0], and have a case for ':', a case for '/', and a
default case.

http://codereview.appspot.com/186130/diff/1010/1011#newcode79
src/pkg/exp/draw/x11/auth.go:79: func readAuthRetry(b []byte) (name, data
string, err os.Error) {
I don't think this retry loop belongs here. If the Xauthority cannot be found,
then the xgb library should simply let that bubble up to the app, and the app
can decide whether or not to retry, based on the os.Error.

Besides, you return early if readAuth fails, which is probably the opposite of
what you intended. If everything's fine, then you actually loop for 10 seconds
(and read the Xauthority file 10 times) unnecessarily.

But really, I'd take the retries out.

On a separate note, Go constants aren't named in ALL_CAPS unlike C
constants/macros. For examples, just grep src/pkg for "const".
Sign in to reply to this message.

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