HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
rsc
c2go
Go2015–2019
rsc / c2go · Archived

c2go

C to Go translation tool supporting Go toolchain migration

6Distinct people
6Mentions
1Explicit recommenders
505GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

C to Go translation tool supporting Go toolchain migration

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

I love the simplicity of the main function: rewriteTypes(cfg, prog) rewriteSyntax(cfg, prog) rewriteLen(cfg, prog) fixGoTypes(cfg, prog) renameDecls(cfg, prog) exportDecls(cfg,…

peterwaller used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year6 dated mentions

Observed mentions: 2015-01-20 05:05:57 UTC to 2019-09-13 21:02:30 UTC.

0122015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC211
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC101
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC101
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101

What Hacker News says

6 sources
Thanks for the thoughtful response. I don't mean to imply that there's a conspiracy here. What I mean is that I think the Plan 9 heritage is clouding strategic decisions around the Go toolchain. What may have been the right decision to get a new language off the ground is not necessarily the right decision once the language is widely popular and stable. > Migrating Go today to LLVM would of course be a big, time-consuming zero-velocity project; you'd want to be really certain that the payoff would be worth the effort. A big project, yes, but it's happening! [3] If a few engineers working on gollvm for a year or two could improve gollvm to the point that it made the average Go program run 20% faster, I'd think that would absolutely be worth it to Google. > GCC is not an easy project to deal with, either. For decades, its internal intermedi
Read the rest
ate representation was undocumented and intentionally obfuscated to ensure FSF/GNU control over backends. Very true in general, but the Go team has been lucky in that GCC core maintainer Ian Taylor has been a member since the early days. Gccgo has been a spec-conformant Go compiler since 2012 [2], and so nearly all of the GCC-integration bits have been in place for seven years. As a result, it's far more a matter of staffing the project so that the Go frontend's inliner, garbage collector, and escape analysis can reach parity with gc, rather than dealing with GCC/FSF politics. > You can browse the original commit here. That stuff has all been rewritten in Go. Yeah, I'm familiar with the lineage. I don't know that I'd say that it's been rewritten in Go, though, as the toolchain and runtime were converted fairly automatically with a "c2go" tool that Russ Cox wrote [0] around the Go 1.5 release. Have you looked at the resulting code much? Some of it has been rewritten to be idiomatic Go, but a lot of it is still very clearly C code that has been automatically translated [1]. See also the fact that go/src/runtime/runtime.go, go/src/runtime/runtime1.go, and go/src/runtime/runtime2.go all exist—a consequence of the fact that runtime.go, runtime.c, and runtime.h all existed in Go 1.4 [2]. [0]: https://github.com/rsc/c2go [1]: https://github.com/golang/go/blob/7b294cdd8df0a9523010f6ffc8... [2]: https://blog.golang.org/gccgo-in-gcc-471 [3]: https://go.googlesource.com/gollvm/+log
In Building a Better Go Linker
Go is so close to C. Wouldn’t it be great if there was a program that could take C code and turn it into Go code? There are few attempts to do that: https://github.com/rsc/c2go https://github.com/elliotchance/c2go https://github.com/cznic/ccgo elliotchance/c2go seems to be the most promising. I didn’t try any of them as neither seems to be usable yet. Actually, we used github.com/rsc/c2go to port our Go compilers and linkers from C to Go. It was 100% mechanical translation. No manual steps needed to achieve correctness. github.com/cznic/ccgo was used to port sqlite to Go. It passes all the (very comprehensive) sqlite test suite. They work very well. The code produced is not very idiomatic Go, but it's not some monstrous impenetrable computer generated code either. It's quite similar to the original
Read the rest
C code and it's readable and refactorable enough. After we converted the compiler from C to Go, we spent a lot of time to make the code more idiomatic.
In Porting 4.5K lines of C to Go

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.