GitRoot

craft your forge, build your project, grow your community freely
 1<!--
 2SPDX-FileCopyrightText: 2025 Romain Maneschi <romain@gitroot.dev>
 3
 4SPDX-License-Identifier: CC-BY-SA-4.0
 5-->
 6
 7# Rationale for Choosing Golang for GitRoot
 8
 9This document outlines the key reasons for selecting Golang as the primary programming language for this project. The decision is based on a combination of powerful library support for core functionalities and developer familiarity with the language.
10
11## 1. Advanced Git Operations with go-git
12
13A core requirement of this project involves sophisticated interaction with Git repositories. The [`go-git`](https://github.com/go-git/go-git) library, a pure Go implementation of Git, is exceptionally well-suited for this purpose.
14
15- **Virtual Filesystem for Worktrees:** `go-git` implements Git's working tree using an in-memory or virtual filesystem. This is a significant advantage as it allows for fine-grained manipulation of repository data without the need to materialize a physical working directory on the disk.
16- **Performance and Control:** This virtualized approach offers enhanced performance for certain operations and provides a high degree of control over how Git data is accessed and modified, which is crucial for the project's specific needs.
17
18## 2. WebAssembly System Interface (WASI) Integration with wazero
19
20The project also requires the ability to execute compiled modules adhering to the WebAssembly System Interface (WASI). The [`wazero`](https://wazero.io/) library stands out as a robust and zero-dependency WebAssembly runtime for Go that provides excellent WASI support.
21
22- **WASI Support and Virtual Filesystem Compatibility:** `wazero` allows the execution of WebAssembly modules that use WASI for system interactions, such as filesystem access. Crucially, `wazero` can leverage Golang's virtual filesystem capabilities (e.g., `io/fs`). This synergy is particularly beneficial as it allows for seamless data flow between the Git operations (managed by `go-git`) and the WASI environment. Data can be read from a Git repository (via `go-git`'s virtual FS) and directly made available to a WASI module running in `wazero` without intermediate disk I/O, streamlining processes and improving efficiency.
23- **Ease of Use and Integration:** `wazero` is designed to be straightforward to integrate into Go applications, providing a clean API for loading, instantiating, and running Wasm modules with WASI capabilities.
24
25## 3. My Developer Proficiency and Golang's Ecosystem
26
27Beyond the specific library advantages, my choice of Golang is also heavily influenced by my existing expertise.
28
29- **Stronger Familiarity:** I have a higher level of proficiency and experience with Golang compared to other systems programming languages like C++ or Rust. This familiarity will translate to faster development cycles, more idiomatic code, and easier debugging for me.
30- **Mature Ecosystem:** Golang boasts a mature and extensive ecosystem with a rich set of standard libraries and a vibrant community, which further supports rapid development and provides solutions for common programming challenges.
31
32In summary, Golang's powerful libraries for Git (`go-git`) and WebAssembly/WASI execution (`wazero`), especially their shared potential for using virtual filesystems, combined with my existing expertise in the language, make it the most pragmatic and effective choice for this project.