GoNotes.adoc · master · Eric S. Raymond / reposurgeon · GitLab

16 bookmarks. First posted by connolly 4 weeks ago.

package main

import "fmt"

type exception struct {
class string
message string

func (e exception) Error() string {
return e.message

func throw(class string, msg string, args ...interface{}) *exception {
// We could call panic() in here but we leave it at the callsite
// to clue the compiler in that no return after is required.
e := new(exception)
e.class = class
e.message = fmt.Sprintf(msg, args...)
return e

func catch(accept string, x interface{}) *exception {
// Because recover() returns interface{}.
// Return us to the world of type safety.
if x == nil {
return nil
err := x.(*exception)
if err.class == accept {
return err

func main() {
defer println("Defer 1")
defer println("Defer 2")
defer println("Defer 3")

defer func() {
fmt.Println("Recover:", catch("recoverable", recover()))
panic(throw("recoverable", "Don't Panic!!!"))

esr  go  python 
2 days ago by tebeka
Experience report on a large Python-to-Go translation ()
from twitter_favs
13 days ago by Jeunj
Notes on a non-trivial Python to Go port.
go  python 
13 days ago by dmdavis
Notes on the Go translation of Reposurgeon This is an experience report on a Python-to-Go translation of aprogram with significant complexity, written in…
from instapaper
13 days ago by carkmorwin
A tool for editing version-control repositories and translating among different systems. Supports git, bzr, Subversion, darcs, and fossil directly, also hg, CVS, and RCS through plugins.
python  golang  comparison  translation 
14 days ago by geetarista
Excellent write up of a conversion of a large scale Python project to Go by Eric Raymond:
from twitter_favs
4 weeks ago by connolly