[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5802":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":30,"discoverSource":31},5802,"borgo","borgo-lang\u002Fborgo","borgo-lang","Borgo is a statically typed language that compiles to Go.","https:\u002F\u002Fborgo-lang.github.io",null,"Rust",4639,67,33,29,0,2,14,27.5,false,"main",[23,24,25,26],"compiler","golang","programming-language","rust-lang","2026-06-12 02:01:15","# The Borgo Programming Language\n\n![Borgo sits between Go and Rust](https:\u002F\u002Fraw.githubusercontent.com\u002Fborgo-lang\u002Fborgo-lang.github.io\u002Fmain\u002Fborgo.jpg)\n\n---\n\n![build](https:\u002F\u002Fgithub.com\u002Fborgo-lang\u002Fborgo\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)\n\nI want a language for writing applications that is more expressive than Go but\nless complex than Rust.\n\nGo is simple and straightforward, but I often wish it offered more type safety.\nRust is very nice to work with (at least for single threaded code) but it's too\nbroad and complex, sometimes painfully so.\n\n**Borgo is a new language that transpiles to Go**. It's fully compatible with\nexisting Go packages.\n\nBorgo syntax is similar to Rust, with optional semi-colons.\n\n# Tutorial\n\nCheck out the **[online playground](https:\u002F\u002Fborgo-lang.github.io\u002F)** for a tour\nof the language.\n\nYou can also take a look at test files for working Borgo code:\n\n- [codegen-emit.md](compiler\u002Ftest\u002Fcodegen-emit.md)\n- [infer-expr.md](compiler\u002Ftest\u002Finfer-expr.md)\n- [infer-file.md](compiler\u002Ftest\u002Finfer-file.md)\n\n# Features\n\n## Algebraic data types and pattern matching\n\n```rust\nuse fmt\n\nenum NetworkState {\n    Loading,\n    Failed(int),\n    Success(string),\n}\n\nlet msg = match state {\n    NetworkState.Loading => \"still loading\",\n    NetworkState.Failed(code) => fmt.Sprintf(\"Got error code: %d\", code),\n    NetworkState.Success(res) => res,\n}\n```\n\n---\n\n## `Option\u003CT>` instead of `nil`\n\n```rust\n\u002F\u002F import packages from Go stdlib\nuse fmt\nuse os\n\nlet key = os.LookupEnv(\"HOME\")\n\nmatch key {\n    Some(s) => fmt.Println(\"home dir:\", s),\n    None => fmt.Println(\"Not found in env\"),\n}\n```\n\n---\n\n## `Result\u003CT, E>` instead of multiple return values\n\n```rust\nuse fmt\nuse net.http\n\nfn makeRequest() -> Result\u003Cint, error> {\n    let request = http.Get(\"http:\u002F\u002Fexample.com\")\n\n    match request {\n        Ok(resp) => Ok(resp.StatusCode),\n        Err(err) => Err(fmt.Errorf(\"failed http request %w\", err))\n    }\n}\n```\n\n---\n\n## Error handling with `?` operator\n\n```rust\nuse fmt\nuse io\nuse os\n\nfn copyFile(src: string, dst: string) -> Result\u003C(), error> {\n    let stat = os.Stat(src)?\n\n    if !stat.Mode().IsRegular() {\n        return Err(fmt.Errorf(\"%s is not a regular file\", src))\n    }\n\n    let source = os.Open(src)?\n    defer source.Close()\n\n    let destination = os.Create(dst)?\n    defer destination.Close()\n\n    \u002F\u002F ignore number of bytes copied\n    let _ = io.Copy(destination, source)?\n\n    Ok(())\n}\n```\n\n---\n\n## Guessing game example\n\nSmall game from the Rust book, implemented in Borgo.\n\nThings to note:\n\n- import packages from Go stdlib\n- `strconv.Atoi` returns an `Option\u003Cint>`\n- `Reader.ReadString` returns a `Result\u003Cstring, error>` (which can be unwrapped)\n\n```rust\nuse bufio\nuse fmt\nuse math.rand\nuse os\nuse strconv\nuse strings\n\nfn main() {\n    let reader = bufio.NewReader(os.Stdin)\n\n    let secret = rand.Intn(100) + 1\n\n    loop {\n        fmt.Println(\"Please input your guess.\")\n\n        let text = reader.ReadString('\\n').Unwrap()\n        let text = strings.TrimSpace(text)\n\n        let guess = match strconv.Atoi(text) {\n            Ok(n) => n,\n            Err(_) => continue,\n        }\n\n        fmt.Println(\"You guessed: \", guess)\n\n        if guess \u003C secret {\n            fmt.Println(\"Too small!\")\n        } else if guess > secret {\n            fmt.Println(\"Too big!\")\n        } else {\n            fmt.Println(\"Correct!\")\n            break\n        }\n    }\n}\n```\n\n## Running locally\n\nBorgo is written in Rust, so you'll need `cargo`.\n\nTo compile all `.brg` files in the current folder:\n\n```bash\n$ cargo run -- build\n```\n\nThe compiler will generate `.go` files, which you can run as normal:\n\n```bash\n# generate a go.mod file if needed\n# $ go mod init foo\n$ go run .\n```\n","Borgo 是一种静态类型语言，可以编译为 Go 代码。它旨在提供比 Go 更强的类型安全性和表达能力，同时避免 Rust 的复杂性。核心功能包括代数数据类型和模式匹配、使用 `Option\u003CT>` 替代 `nil` 以及用 `Result\u003CT, E>` 来处理错误，这些特性增强了代码的安全性和可读性。此外，Borgo 还支持通过 `?` 操作符简化错误处理流程。该语言非常适合那些希望在保持 Go 生态系统兼容性的同时，寻求更高级别类型安全性的开发者使用。","2026-06-11 03:05:06","top_language"]