Profile

Cover photo
Scott Corbeil
77 followers|51,637 views
AboutPostsPhotosVideos

Stream

Scott Corbeil

Discussion  - 
 
Not strictly Go related, but I know many of the community members here were interested in trying Atom.io as an editor.  I'm not sure when this was done, but it looks like they've added docs for building from source: https://github.com/atom/atom/blob/master/README.md#building

I'm having issues atm, but I believe they are proxy related.  
5
John-Alan Simmons's profile photoAndrey Chesnokov's profile photoAlex Alectic's profile photoScott Corbeil's profile photo
7 comments
 
Its essentially a chromium embedded application, so yes written in JS (technically mostly coffeescript)
Add a comment...

Scott Corbeil

Discussion  - 
 
TIL some interesting Go stuff.  I wasn't aware that the blank identifier could be used to fit a function's signature to a particular type without actually storing the argument (i.e. func(x int, _ int)).  It also hadn't occurred to me, perhaps due to lack of need, that I could define methods on a function type, like http.HandlerFunc.  Functions with methods... mind blown. :)
7
2
Julien Schmidt's profile photoMilton Baxter's profile photogeorge oloo's profile photoIngo Gottwald's profile photo
2 comments
 
Yes, function signatures are types in Go!

10 more things you (probably) don't know about Go: http://nf.wh3rd.net/10things/#1 (some of these are a bit more advanced topics)
Add a comment...
 
Hey Gophers: any suggestions for a browser-based code editing environment well-suited to Go?  Got a Chromebook and looking for the easiest way to code on it (obviously, that's not why I bought it, but if I can code effectively with it, I'd like to).
3
1
Yves Junqueira's profile photoJan Mercl's profile photoBryan Mills's profile photoScott Corbeil's profile photo
7 comments
 
SSH + tmux + emacs
Add a comment...

Scott Corbeil

Discussion  - 
 
Sometimes I wish I could defer a return statement.  Like when I pop an item from a container, for example.  It would be neat to do:

func (c *Container) Pop() *Item {
    defer return c.top
    // remove c.top from container
}

Maybe this is a terrible idea.  I've run into a few scenarios where I thought it would be cool, but it's not a huge inconvenience without.
1
David Farrell's profile photoGo Search's profile photoScott Corbeil's profile photoIngo Gottwald's profile photo
10 comments
 
It wasn't a joke, it was an attempt to see if I could find a useful work-around. I couldn't, hence my quote.
Add a comment...

Scott Corbeil

Discussion  - 
 
What do you all think is the most idiomatic way to send EOF in a stream of runes?  Unicode EOT? -1? Refactor to send an error as well and use io.EOF?  Something else entirely?
1
Ralph Corderoy's profile photoSteve Ruckdashel's profile photoScott Corbeil's profile photo
7 comments
 
+Ralph Corderoy I'm writing a lexer, so the caller (a state function) on EOF would most likely emit an EOF token.

I did, in fact, end up refactoring to return multiple results.  I also managed to find (what I think is) a pretty way to write that statement:

switch r, e := x.Next(); {
case e != nil:
    // stuff
case p(r): // p is a predicate, or func(rune) bool
    // stuff
default:
    // stuff
}
Add a comment...

Scott Corbeil

Discussion  - 
 
Apparently Go object files have a cleartext header.  Check out the answer with an example at the following link (it was second highest voted at the time of my posting this):

http://stackoverflow.com/questions/1720201/go-examples-and-idioms
1
1
Andrew Wilkins's profile photoДавид Мзареулян's profile photoFrederick ROS's profile photoScott Corbeil's profile photo
9 comments
 
+Давид Мзареулян +Scott Corbeil Inlineable functions' bodies will be in the export header too, allowing inlining across packages.
Add a comment...
Have him in circles
77 people
Connie Pfeiffer's profile photo
Connie Bechtel's profile photo
Megan Tackett's profile photo
Allison Johnson's profile photo
Nellie Neal's profile photo
William Kennedy's profile photo
Jeanne Delahunty's profile photo

Scott Corbeil

Discussion  - 
 
Anybody know of a good package or other solution for document generation (PDF preferrably) with Go?  What I'm thinking for the moment is generating a LaTeX document and converting it, but there may be a better way...

EDIT: Spelling
2
2
Justen Robertson's profile photoStefan Schroeder's profile photoMauro Risonho de Paula Assumpção's profile photoScott Corbeil's profile photo
10 comments
 
+Gath Gealaich Troff would be enough in most cases. And troff has a very good specification...
Add a comment...
 
I could use an extra set of eyeballs, if anybody's feeling charitable this morning.  A friend/colleague from our sales department asked me to help him find a way to guide he and his team to more easily identify redundant accounts in our system.  Duplicates are usually caused by poor effort to search for an existing account, so the rep just creates a new one instead.  I thought maybe edit distance could help to identify similarly named accounts, so I hacked together the attached.

There are, in total, just shy of 121 billion comparisons to be made, so I left it running overnight.  More than a third of the region jobs had completed before I left last night.  I wasn't profiling, but I monitored the memory and CPU consumption in Task Manager and that appeared stable/not leaking.  When I came in this morning, it had crashed.  There isn't much useful information in the crash report because it's so long that I can't scroll up to see most of it, and it appears that there were nearly 9000 goroutines?  Here's the last one (all of those which I can see are identical except for the goroutine number): 

goroutine 8951 [runnable]:
main.process(0xc085f02470, 0x2, 0xc088385000, 0x5903, 0x5ae8, ...)
        \\path\to\gopath\main.go:87
created by main.main
        \\path\to\gopath\main.go:178 +0xb4e

Am I leaking goroutines?   I'm confused because I watched for a few hours and it never consumed more than around 160 MB of memory and was typically down around 147.

A note: the package "files", which should be the only one you don't recognize from the imports, is a helper package I use as I very frequently process files at work.  The function used (files.ReadCSV) takes an io.Reader and a function, reads each line of CSV input from the Reader and passes it line by line to the function argument.

I hate sharing code that was hacked together quickly like this, so cut me some slack if it's horrendous, please :).  This is not production stuff, just a hack for a friend.
3
1
Luit van Drongelen's profile photoMatt Dragon's profile photoScott Corbeil's profile photoBryan Mills's profile photo
17 comments
 
Thanks again to everyone who commented here.  I made the adjustments mentioned this afternoon and boy did this run fast.  I used +Andrew Gallant's tip to factor out the allocation and +Bryan Mills' presentation snippet for concurrency.  Went smoothly and completed (121 billion coparisons) in about 2 hours.  CPU usage maxed out, too :)
Add a comment...

Scott Corbeil

Discussion  - 
 
Got official approval from the boss to attend Gophercon this morning.  Wooohooo, can't wait for April!

Thank you to the people who put this event on and thank you to the Go team for all your hard work and brilliance! :)
8
Brian Ketelsen's profile photo
 
that's awesome.  See you there!
Add a comment...

Scott Corbeil

Discussion  - 
 
I need to calculate edit distances.  Maybe diffs, too.  Not sure I'll need the full diffs yet, but definitely edit distances.  I was going to write a package from scratch, but decided to look for prior art (in Go) first.  I see a few packages out there.  Any recommendations?  Has anybody used any existing edit distance packages?
2
Ralph Corderoy's profile photoSonia Keys's profile photoScott Corbeil's profile photo
5 comments
 
+Ralph Corderoy, Absolutely.  +Scott Corbeil, Ralph is pointing out some optimizations that are good practice almost anywhere you want to write efficient code (in other languages as well.)  Some optimizing compilers may be clever at common subexpression removal, but it's usually best to recognize common subexpressions yourself and explicitly code them.  A short variable declaration as the simple statement in an if (or switch, etc.) statement is an idiomatic way to do this in Go.
Add a comment...

Scott Corbeil

Discussion  - 
 
I'm shuffling through the docs and unable to find this: is there a type in the standard library that wraps an io.Reader with an io.RuneReader?  So that I could, for example, wrap the return value of os.Open() with a RuneReader?
2
1
Kamil Kisiel's profile photoScott Corbeil's profile photocan xiang's profile photo
4 comments
 
That's pretty cool, thanks +Kamil Kisiel 
Add a comment...

Scott Corbeil

Discussion  - 
 
Can anybody recommend a good introduction to programming using Go?  My younger brother has asked me to teach him how to program.  I like to think I'm pretty competent, but I've never taught anybody before.  I gave him a book and he complained that the book makes too many assumptions about his requisite knowledge.  In other words, I'm not looking for just an intro to Go, but an intro to programming itself (in Go).

If you think Go is the wrong language to start him with, by all means please say why.  I think it's perfect.  It has "C-inspired" syntax that he'll recognize in other languages, he doesn't have to worry about memory (de)allocation, and I personally think it will teach him some good practices and methods of thinking and solving problems.
6
1
Philippe Lhoste's profile photoAse Deliri's profile photoScott Corbeil's profile photoDaniel Pruett's profile photo
38 comments
 
Agreed with +Gustavo Niemeyer , +roger peppe , and +Rob Pike . Not to mention that Python may seem easier at first glance, but is in fact more complicated, with more weird corner cases to know about than in Go.
Add a comment...
People
Have him in circles
77 people
Connie Pfeiffer's profile photo
Connie Bechtel's profile photo
Megan Tackett's profile photo
Allison Johnson's profile photo
Nellie Neal's profile photo
William Kennedy's profile photo
Jeanne Delahunty's profile photo
Basic Information
Gender
Male
Work
Occupation
Product Management Technician
Links