Skip to content

tylerlaprade/go2rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,189 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Go2Rust CI

The last Go program you'll ever need!

gopher2ferris Artwork by Bonnie Hansen

A conservative Go-to-Rust transpiler that prioritizes correctness over performance.

Usage

# Build the transpiler
go build -o go2rust ./go

# Transpile a Go file
./go2rust input.go > output.rs

# Run tests
./test.sh

# Check that the self-transpiled Rust builds
CARGO_BUILD_JOBS=1 CARGO_INCREMENTAL=0 RUSTFLAGS=-Awarnings ./self_transpile_check.sh --cargo-check

# Behavior gate: build the self-transpiled Rust transpiler and run the fixture
# suite against that generated binary in a copied test workspace.
CARGO_BUILD_JOBS=1 CARGO_INCREMENTAL=0 RUSTFLAGS=-Awarnings ./self_transpile_check.sh --behavior-suite

The self-transpile cargo check gate only proves that generated Rust compiles. The behavior gate is the required self-hosting acceptance check: the generated Rust transpiler must run the fixture suite and produce the same outputs as the Go implementation.

Current status: the generated Rust transpiler builds and runs the copied behavior suite, but self-hosting is not complete β€” not every fixture yet produces matching output through the generated binary. Run the behavior gate above for the current state.

External Package Handling

Go2Rust provides four modes for handling external package imports:

  1. transpile (default): Recursively transpiles all dependencies to Rust

    • Pure Rust output with no Go runtime dependency
    • Currently in development
    • Uses one workspace wrapper policy across the root package and transpiled dependencies
    • Emits shared stdlib stand-ins and shared helper types in vendor/go2rust_stdlib_stubs so dependency crates agree on imported stdlib type identities
  2. stub: Generates stub implementations for external packages

    • Creates placeholder Rust modules with helpful TODO comments
    • Allows you to manually implement or use Rust equivalents
    • Useful when automatic transpilation fails or when you want custom implementations
    • Stub files are generated in vendor/ directory
  3. ffi: Generates FFI bridge to call Go libraries from Rust

    • Keeps Go packages as-is and generates bindings
    • Useful for packages with cgo or complex dependencies
    • Currently in development
  4. none: Fails if external packages are imported

    • Useful for simple, self-contained programs
    • Ensures no external dependencies

Example

Input (Go):

package main

import "fmt"

func GetGreeting() string {
    return "Hello, World!"
}

func GetYear() int {
    return 2024
}

func main() {
    fmt.Println(GetGreeting())
    println(GetYear())
}

Output (Rust) - Single-threaded code:

use std::cell::{RefCell};
use std::rc::{Rc};

pub fn get_greeting() -> Rc<RefCell<Option<String>>> {
    Rc::new(RefCell::new(Some("Hello, World!".to_string())))
}

pub fn get_year() -> i32 {
    2024
}

fn main() {
    println!("{}", format!("{}", (*get_greeting().borrow().as_ref().unwrap())));
    eprintln!("{}", format!("{}", get_year()));
}

When the transpiler detects concurrency (goroutines, channels, or async stdlib calls), it automatically uses Arc<Mutex<Option<T>>> instead for thread safety.

Philosophy

This transpiler uses a "make it work first, optimize later" approach. Most Go values are wrapped for safety, but the wrapper type depends on concurrency needs:

  • Single-threaded code: Uses Rc<RefCell<Option<T>>> for better performance
  • Concurrent code: Uses Arc<Mutex<Option<T>>> for thread safety
  • Predeclared Copy scalar return slots: Function boundaries can use bare Rust scalars such as i32 or bool once go/types proves the result type

This ensures semantic correctness for ANY Go program, even edge cases like taking the address of function parameters. The generated code is verbose but correct. Users can optimize later.

Progress Tracking

Go Keywords (25 total)

Keyword Status
break - Break statements βœ…
β”” Direct break in switch and type-switch cases βœ…
case - Case clauses
β”” Switch cases βœ…
β”” Select cases βœ…
β”” Type switch cases βœ…
β”” Type switches over temporary call results βœ…
chan - Channel types βœ…
β”” Channel struct fields with nil checks, send/receive, len, and cap βœ…
β”” Package-level channel globals initialized with make βœ…
const - Constants
β”” Basic constants βœ…
β”” String constants passed to strings.Builder βœ…
β”” String constants in array/slice literals βœ…
β”” Iota enumerations βœ…
β”” Complex iota expressions βœ…
β”” Named iota-backed enum types, including struct fields, untyped literal fields, and underlying const widths βœ…
β”” Named integer constants passed to function and method parameters βœ…
β”” Named integer constants in binary expressions with typed peers βœ…
β”” Named integer bitwise compound assignments with constant RHS values βœ…
β”” External stdlib named-integer const expressions βœ…
β”” Cross-file package constants in compound assignments βœ…
continue - Continue statements βœ…
β”” Unlabeled continue in for init; cond; post executes the post statement before continuing βœ…
default - Default clauses
β”” Switch default βœ…
β”” Select default βœ…
defer - Defer statements βœ…
β”” Methods with named returns and deferred result mutation βœ…
β”” Named return captures in deferred map writes βœ…
β”” Deferred field writes honor capture renames βœ…
β”” Deferred nested pointer field updates βœ…
β”” Defer statements inside select case bodies βœ…
else - Else clauses βœ…
fallthrough - Fallthrough statements βœ…
for - For loops
β”” C-style for loops βœ…
β”” While-style loops βœ…
β”” Infinite loops βœ…
β”” Range loops (slice/map/string/channel, nil slices) βœ…
β”” Range value field access for pointer slices βœ…
β”” Range string values passed to string parameters, compared, used in string helpers, and appended βœ…
β”” Range string values reused in []string literals βœ…
β”” Reference-style range values copied by short declarations βœ…
β”” Range string values captured by closures βœ…
β”” Wrapped string values from map ranges compare as owned strings βœ…
β”” Wrapped string values from map ranges copy into scalar map values βœ…
β”” Wrapped string values from map ranges insert as owned map keys βœ…
β”” Range struct values passed to function and method parameters βœ…
β”” Range stdlib-interface slice values used in calls, assignments, type switches, and assertions βœ…
β”” Stdlib-interface slice values compared with nil βœ…
β”” Range indexes passed to Go int parameters or assigned to Go int locals βœ…
β”” Range over integers βœ…
func - Functions
β”” Basic functions βœ…
β”” Multiple return values βœ…
β”” Method definitions βœ…
β”” Case-distinct methods that collapse to the same Rust name on one receiver βœ…
β”” Reassigned function and method parameters βœ…
β”” Tuple return reassignment to fields and parameters βœ…
β”” Method calls, including receiver self-calls βœ…
β”” Current receiver method calls with receiver-referencing arguments βœ…
β”” Method calls with function-literal arguments that capture the receiver βœ…
β”” Cross-file receiver mutability analysis βœ…
β”” Wrapped call results passed as method/function arguments βœ…
β”” Typed nil arguments passed to package functions βœ…
β”” Function-valued struct field calls βœ…
β”” Method selectors returning function values stay method calls βœ…
β”” Pointer-receiver method values returned or assigned as func values βœ…
β”” Named function type conversions βœ…
β”” Cross-package named function type conversions βœ…
β”” Function type aliases with imported interface parameters βœ…
β”” Function type aliases with pointer returns βœ…
β”” Function literals/closures with scoped nested captures βœ…
β”” Function literal named result parameters βœ…
β”” Function variables and higher-order function values βœ…
β”” Function values lower as FnMut and support recursive calls βœ…
β”” Function parameters forwarded to function/method parameters βœ…
β”” Function values stored in map literals βœ…
β”” Package function selectors assigned to function fields βœ…
β”” Function-typed named returns and deferred assignments βœ…
β”” Instantiated generic function type aliases βœ…
β”” Focused type-parameter constraints in concrete helper signatures such as S ~[]T, T ~string βœ…
β”” Assignment from function return values βœ…
β”” Variadic functions βœ…
β”” Cross-file variadic function calls βœ…
β”” Imported transpiled package variadic calls βœ…
β”” Address-of selector fields passed as fixed variadic arguments βœ…
go - Goroutines βœ…
β”” Worker pool pattern with channels βœ…
β”” Method receiver captures with deferred receiver calls βœ…
β”” Function-typed parameter captures βœ…
goto - Goto statements βœ… (basic top-level label patterns)
if - If statements
β”” Basic if βœ…
β”” If with init statement βœ…
β”” If-else chains βœ…
import - Imports
β”” Single imports βœ…
β”” Multiple imports βœ…
β”” Package aliases βœ…
β”” Blank imports βœ…
β”” Stdlib type signatures βœ…
β”” Stdlib method stubs from selector type information βœ…
β”” Stdlib pointer method calls from indexed and range receivers βœ…
β”” Stdlib os.File direct method stubs from external package returns βœ…
β”” Stdlib package function/constant/variable stubs βœ…
β”” Stdlib package variadic stub calls βœ…
β”” Stdlib package stub calls from wrapped range variables βœ…
β”” Stdlib package stub calls preserve pointer handle arguments βœ…
β”” Stdlib typed constants as indexes βœ…
β”” Shared stdlib stubs across transpiled dependency crates βœ…
β”” Shared context/channel helpers across transpiled dependency crates βœ…
β”” context.Context helpers implement formatting traits for generated structs and format calls βœ…
β”” context.Context.Err returns boxed error handles βœ…
β”” Stdlib concrete values passed to stdlib interface parameters βœ…
β”” Stdlib concrete values passed to stdlib interface parameters across transpiled package calls βœ…
β”” Stdlib interface map range keys passed to interface parameters βœ…
β”” Stdlib interface map range keys reused as map keys βœ…
β”” Stdlib interface field copies βœ…
β”” Stdlib interface selector type assertions βœ…
β”” Stdlib interface indexed type assertions βœ…
β”” Stdlib interface range-value short declarations βœ…
β”” Stdlib interface range values used in slice literals βœ…
β”” Stdlib pointer field stubs without nested wrappers βœ…
β”” Concurrent stdlib selector string comparisons βœ…
interface - Interface types
β”” Interface definitions βœ…
β”” Interface embedding (methods inherited from embedded interfaces are callable on the outer trait object) βœ…
β”” Empty interface{} βœ…
β”” Named any returns default to nil βœ…
β”” Selector fields returned as any preserve the interface handle βœ…
β”” Existing any values assigned to any fields preserve the interface handle βœ…
β”” Empty struct literals with any fields default to nil βœ…
β”” Concurrent any and local-interface fields/globals use Send + Sync trait objects βœ…
β”” Local interface values clone, store, return, compare, and work with slices.Contains via generated trait-object helpers βœ…
β”” Interface comparisons against concrete package-global pointers βœ…
β”” Typed constants passed to local interface parameters βœ…
β”” Variadic any arguments βœ…
β”” Interface implementations βœ…
β”” Type assertions βœ…
β”” any(x) conversions feeding type assertions βœ…
β”” Static any(x).(interface{...}) assertions when TypeInfo proves implementation βœ…
β”” Stdlib concrete pointer literals and values returned as stdlib interface types βœ…
β”” Stdlib interface selector type assertions βœ…
β”” Imported transpiled interfaces implemented by current-package concrete types βœ…
β”” Boxed error values asserted back to error βœ…
β”” Wrapped error arguments and sentinel comparisons βœ…
β”” Concrete values implementing error passed to error parameters βœ…
β”” Package-qualified stdlib concrete error variables passed to error parameters βœ…
β”” Error() calls on wrapped error interface values and fields βœ…
β”” Error selector fields returned through error results βœ…
β”” Error values sent, received, and returned through channels βœ…
β”” Error values stored, assigned, looked up, appended, and ranged through slices and maps βœ…
β”” Error slices allocated with make in inferred local declarations βœ…
β”” Structs embedding the predeclared error interface βœ…
β”” Type switches, including nil, selector pointer, and stdlib named-slice cases βœ…
map - Map types
β”” Map types βœ…
β”” Map literals βœ…
β”” Map operations (insert, delete) βœ…
β”” Delete through selector map fields βœ…
β”” Selector map fields in lookup, comma-ok, and range contexts βœ…
β”” Selector map field short declarations preserve map-header copy semantics βœ…
β”” Promoted embedded pointer map fields in replacement assignments and indexed pointer expressions βœ…
β”” Map assignments through captured closure variables βœ…
β”” Map assignment keys reused by inserted values βœ…
β”” Wrapped map ranges drop map borrows before loop bodies βœ…
β”” Wrapped map range values used as lookup/delete keys βœ…
β”” Owned map range keys used in comma-ok lookups βœ…
β”” Owned map range keys passed to calls and stored as map values βœ…
β”” Map access with existence check βœ…
β”” Comma-ok map access with typed zero values βœ…
β”” Wrapped call results as map lookup keys βœ…
β”” Handle-shaped map lookup values passed as call arguments βœ…
β”” Pointer keys in map literals and lookups βœ…
β”” Pointer keys and values in make(map), address-of literal map writes, and slice-range pointer key lookups βœ…
β”” Pointer map values assigned from selector fields preserve handle aliasing βœ…
β”” Named integer values in map literals, writes, lookups, and comma-ok zero values βœ…
β”” Range indexes assigned into Go int map values βœ…
β”” Struct keys with named integer fields across split modules βœ…
β”” Append results assigned into map slice values βœ…
β”” Nested range over map slice values βœ…
β”” Map range slice values assigned to local slices βœ…
β”” Owned map-range keys reused after map assignments βœ…
β”” Map iteration (for range) βœ…
β”” Map printing (sorted keys, Go 1.12+) βœ…
package - Packages
β”” Main package βœ…
β”” Library packages βœ…
β”” Package-level variable initialization βœ…
β”” Package-level error initialization βœ…
β”” Package-level map literal initialization βœ…
β”” Package-level named slice declarations βœ…
β”” Package-level inferred arrays of anonymous structs βœ…
β”” Package-level channel globals initialized with make βœ…
β”” Package-level pointer globals initialized from constructor calls βœ…
β”” Package-level slice snapshots assigned to locals βœ…
β”” Direct dereference of package-level pointer globals βœ…
β”” Field access through package-level pointer globals βœ…
β”” Exported package globals from transpiled dependency crates keep their Go names and public visibility βœ…
β”” Method calls on exported pointer globals from transpiled dependency crates βœ…
β”” Init functions βœ…
β”” Multi-file packages with cross-file types, methods, maps, slices, and function variables 🚧
β”” Package-scoped generated helpers for multi-file stdlib/time/context types βœ…
β”” Stdlib helper types crossing dependency crate boundaries use shared stub crate identities βœ…
β”” Workspace-wide wrapper selection for transpiled external packages βœ…
range - Range clauses
β”” Array/slice range, including nil slices βœ…
β”” Map range βœ…
β”” String range βœ…
β”” String range runes in rune call arguments, switches, and integer comparisons βœ…
β”” Range indexes assigned into Go int map values βœ…
β”” Range indexes passed to Go int parameters βœ…
β”” Range string values from slice fields in comparisons, string helpers, and append calls βœ…
β”” Reference-style range values copied by short declarations βœ…
β”” Pointer range values returned as handles βœ…
β”” Wrapped string values from map ranges insert as owned map keys βœ…
β”” Owned map-range keys remain usable after map assignments βœ…
β”” Owned map-range keys remain usable after calls and map value stores βœ…
β”” Range stdlib-interface slice values used in calls, assignments, type switches, and assertions βœ…
β”” Stdlib-interface slice values compared with nil βœ…
β”” Channel range βœ…
return - Return statements
β”” Single return values βœ…
β”” Multiple return values βœ…
β”” Named returns βœ…
β”” Predeclared Copy scalar return slots lower to bare Rust scalar types βœ…
β”” Tail-position returns emit Rust tail expressions without return or ; βœ…
β”” Slice and map literal returns βœ…
select - Select statements βœ…
β”” Returning from select communication and default cases βœ…
struct - Struct types
β”” Struct definitions βœ…
β”” Struct literals βœ…
β”” Comparable struct literals in equality expressions βœ…
β”” Channel fields in struct literals βœ…
β”” Selector-qualified struct literals (pkg.Type{}) βœ…
β”” Stdlib struct field stubs from selector type information βœ…
β”” Field access βœ…
β”” Owned selector field returns and arguments βœ…
β”” Owned selector field short declarations βœ…
β”” Selector scalar and struct fields copy with Go value semantics βœ…
β”” Embedded fields βœ…
β”” Embedded predeclared error promotion βœ…
β”” Embedded method promotion from transpiled dependency packages βœ…
β”” Anonymous structs βœ…
β”” Nested structs/slices/maps/interfaces and anonymous struct function boundaries βœ…
β”” Struct fields containing map values with any contents βœ…
β”” Struct tags βœ…
switch - Switch statements
β”” Basic switch βœ…
β”” Type switch βœ…
β”” Fallthrough βœ…
type - Type definitions
β”” Struct types βœ…
β”” Type aliases βœ…
β”” Type definitions βœ…
β”” Go type names that collide with Rust prelude types are escaped in generated Rust βœ…
β”” Named scalar newtypes usable across generated modules βœ…
β”” Named scalar equality comparisons βœ…
β”” Instantiated generic function type aliases βœ…
β”” Numeric conversions from literals and expressions βœ…
β”” Numeric conversions from named integer values βœ…
β”” Untyped constants assigned to byte-sized slots βœ…
β”” Named slice type definitions in methods, parameters, ranges, indexing, append, and field method arguments βœ…
β”” Named slice type definitions in package globals βœ…
β”” Interface types βœ…
var - Variable declarations
β”” Basic var declarations βœ…
β”” Package-qualified local zero values βœ…
β”” Package-level declarations and initializer order βœ…
β”” Package-level fixed and inferred array declarations βœ…
β”” Package-level inferred anonymous struct array declarations βœ…
β”” Package-level map snapshots assigned to locals βœ…
β”” Package-level slice snapshots assigned to locals βœ…
β”” Short declarations (:=) βœ…
β”” Selector slice field short declarations βœ…
β”” Blank identifier (_) βœ…
Arrays & Slices
β”” Fixed arrays βœ…
β”” Fixed array literals with omitted trailing zero values βœ…
β”” Fixed array zero values above Rust's built-in Default array sizes βœ…
β”” Slices βœ…
β”” Array/slice literal elements from wrapped call results βœ…
β”” Array/slice/map literals passed to package functions βœ…
β”” Slice operations βœ…
β”” Append into indexed slice elements inside arrays/slices βœ…
β”” Append slice values into nested slices βœ…
β”” Assignment into nested indexed slice elements βœ…
β”” Tuple-return assignments into indexed slice elements βœ…
β”” cap on wrapped slice fields βœ…
β”” Range over wrapped call results and pointer-to-array targets βœ…
β”” Named integer values as array/slice indexes βœ…
β”” Parallel slice element swaps βœ…
β”” Parallel slice-expression assignments into wrapped fields βœ…
β”” Concurrent indexed byte compound assignments βœ…
Operators
β”” Binary operators (+, -, *, /, etc.) βœ…
β”” Complex nested expressions with function calls, indexing, fields, pointers, assertions, and channel receives βœ…
β”” Unary NOT and conditions on wrapped bools βœ…
β”” Concurrent binary comparisons with bare len/cap operands βœ…
β”” Binary len/cap operands with typed int peers βœ…
β”” Untyped constants compared with named and typed integer operands βœ…
β”” Cross-file named integer conversions from wrapped calls βœ…
β”” Named integer bitwise expressions and same-type ^= assignment βœ…
β”” Assignment operators (=, +=, etc.) βœ…
β”” Increment/decrement (++, --) βœ…
β”” Address-of (&) βœ…
β”” Dereference (*) βœ…
Pointers
β”” Pointer types (*T) βœ…
β”” Address-of operator βœ…
β”” Dereference operator βœ…
β”” Pointer aliasing βœ…
β”” Pointer receiver nil comparisons and pointer variable call arguments βœ…
β”” Pointer receivers stored in pointer fields βœ…
β”” Pointer receiver dereference assignment (*p = T{...}) βœ…
β”” Address-of struct literals in multi-name short declarations βœ…
β”” Address-of composite literals passed to pointer parameters βœ…
β”” Address-of local values passed to pointer parameters βœ…
β”” Address-of selector fields passed to pointer parameters βœ…
β”” Pointer type assertions passed to pointer parameters βœ…
β”” Address-of slice elements with named integer indexes βœ…
β”” Address-of struct fields and slice elements βœ…
β”” Declared pointers to slice elements βœ…
β”” Field access through ranged slice pointers βœ…
String Operations
β”” String concatenation (+) βœ…
β”” String += operator βœ…
β”” String += from wrapped formatted string calls βœ…
β”” Returning string constants from string functions βœ…
β”” Package string constants as map keys βœ…
β”” String comparisons βœ…
β”” Byte comparisons with character literals βœ…
β”” Raw string literals βœ…
β”” len on string literals in slice bounds βœ…
β”” []byte/[]rune conversions from selector expressions βœ…
Closures & Anonymous Functions
β”” Function literals βœ…
β”” Closure variable capture βœ…
β”” Function literal named result parameters βœ…
β”” Struct literal field keys are excluded from closure capture βœ…
β”” Methods on named function types βœ…
β”” Recursive closure assignment through function variables βœ…
β”” Closures that call captured pointer receivers through func parameters βœ…
β”” Anonymous function calls βœ…
β”” Cross-file function variables βœ…
β”” Capture analysis framework βœ…
defer - Defer statements
β”” Basic defer βœ…
β”” Multiple defers (LIFO order) βœ…
β”” Defer with closures βœ…
β”” Defer stack management βœ…

Standard Library Functions

Function Status
Built-in functions
β”” println βœ…
β”” len βœ…
β”” cap βœ…
β”” len/cap passed to Go int parameters βœ…
β”” len/cap short declarations as Go int values βœ…
β”” len/cap var declarations as Go int values βœ…
β”” min/max over ordered basic values βœ…
β”” append βœ…
β”” append expansion from selector slice fields βœ…
β”” copy βœ…
β”” make βœ…
β”” delete βœ…
β”” new βœ…
fmt package
β”” fmt.Println βœ…
β”” fmt.Printf βœ…
β”” fmt.Sprintf βœ…
β”” fmt.Sprintf("%v", selectorSlice) βœ…
β”” fmt.Sprintf("%s", []*T) when T implements String() string βœ…
β”” fmt.Errorf βœ…
β”” fmt.Fprintln βœ…
β”” fmt.Fprintf βœ…
β”” %w error formatting βœ…
β”” %T type-name formatting in errors βœ…
β”” Dynamic-format panic(fmt.Errorf(...)) βœ…
β”” %+v debug and %#x alternate hex formatting βœ…
β”” %x/%X byte formatting βœ…
strings package
β”” strings.ToUpper βœ…
β”” strings.ToLower βœ…
β”” strings.TrimSpace βœ…
β”” strings.TrimSpace on string slice expressions βœ…
β”” strings.TrimSpace on []string index expressions βœ…
β”” strings.Title βœ…
β”” strings.Contains βœ…
β”” strings.Index / strings.LastIndex / strings.IndexAny βœ…
β”” strings.Count βœ…
β”” strings.Compare / strings.Cut βœ…
β”” strings.HasPrefix / strings.HasSuffix βœ…
β”” Dynamic strings arguments with package const separators βœ…
β”” strings.Split / strings.Join / strings.Fields βœ…
β”” strings.Replace / strings.ReplaceAll βœ…
β”” strings.Repeat βœ…
β”” strings.EqualFold βœ…
β”” strings.Trim / strings.TrimLeft / strings.TrimRight βœ…
strconv package
β”” strconv.Itoa βœ…
β”” strconv.Atoi βœ…
β”” strconv.FormatFloat / strconv.FormatInt βœ…
math package
β”” math.Pi / math.E βœ…
β”” math.Sqrt βœ…
β”” math.Pow βœ…
β”” math.Max / math.Min βœ…
math/rand package
β”” rand.Seed, rand.Intn, rand.Float64 βœ…
encoding/json package
β”” json.Marshal for structs with exported basic fields βœ…
β”” json.Marshal for struct map[string]string fields with omitempty βœ…
β”” json.Marshal for named scalar, []string, and map[string][]byte struct fields βœ…
encoding/base64 package
β”” base64.StdEncoding.EncodeToString βœ…
β”” base64.StdEncoding.DecodeString βœ…
crypto/sha256 package
β”” sha256.Sum256 βœ…
net/url package
β”” url.Parse βœ…
regexp package
β”” regexp.MustCompile + basic FindAllString (\d+ and literal matches) βœ…
β”” MatchString, FindStringSubmatch, and ReplaceAllString for supported patterns βœ…
reflect package
β”” reflect.TypeOf struct field metadata and StructTag.Get βœ…
β”” reflect.StructTag(string).Get conversions βœ…
β”” Pointer conversions to reflected struct header stand-ins βœ…
unsafe package
β”” unsafe.Sizeof / unsafe.Alignof for Rust representation layout βœ…
β”” unsafe.Sizeof in integer comparisons and conversions βœ…
β”” Named unsafe.Pointer definitions round-trip through uintptr and any βœ…
errors package
β”” errors.New βœ…
β”” Package-level errors.New values βœ…
β”” Custom error types βœ…
β”” Type assertions on errors βœ…
β”” Error handle arguments and equality comparisons βœ…
flag package
β”” flag.String / flag.Parse default values βœ…
time package
β”” time.Unix, Time.UTC, Time.Add, Time.Unix, Time.UnixNano βœ…
β”” time.NewTimer plus Timer.C receive and Timer.Stop βœ…
β”” time.After timeout channels βœ…
β”” time.NewTicker plus Ticker.C receive and Ticker.Stop βœ…
β”” time.Tick periodic channels βœ…
β”” time.Duration unit expressions in assignments and comparisons βœ…
context package
β”” context.Background, context.WithTimeout, context.WithCancelCause, Context.Done, Context.Err, cancel funcs βœ…
β”” context.Context formatting through generated helper Display/Debug traits βœ…
os package
β”” os.Args read access βœ…
β”” os.Create / os.Remove plus file WriteString / Close βœ…
sort package
β”” sort.Strings βœ…
slices package
β”” slices.Sort / slices.SortFunc / slices.Contains βœ…
β”” slices.Clone / slices.Clip βœ…
sync package
β”” sync.WaitGroup βœ…
β”” Zero-value sync.WaitGroup struct fields βœ…
β”” sync.Mutex βœ…
β”” Direct sync.Mutex.Unlock after Lock βœ…
β”” sync.Once βœ…
β”” sync.Once.Do callbacks that initialize receiver fields βœ…
sync/atomic package
β”” atomic.AddInt64 / atomic.LoadInt64 βœ…
strings (Builder)
β”” strings.Builder βœ…
β”” Builder.WriteString with string constants βœ…
β”” Builder methods on short-declared strings.Builder{} values βœ…
β”” Builder.String returns in concurrent mode βœ…

XFAIL Tests (Expected Failures)

The tests/XFAIL/ directory contains tests for features not yet implemented. These tests:

  • Document the roadmap: Each XFAIL test represents a planned feature
  • Enable TDD workflow: Write the Go code you want to support, then implement the transpiler
  • Auto-promote when ready: If an XFAIL test starts passing, it automatically moves to the main test suite
  • Fail CI on unexpected passes: Prevents accidental feature implementation without proper review

Contributing XFAIL Tests

To report an unimplemented or broken feature, create a pull request adding tests/XFAIL/feature_name/main.go with compilable, deterministic Go code.

About

The last Go program you'll ever need!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

 
 
 

Contributors