Experiments in porting over Golang stdlib into Mojo.
It will not always be a 1:1 port, it's more so code inspired by the Golang stdlib and the Mojo community's code. This is not intended to be a full port, but rather a learning exercise and a way to experiment with Mojo's capabilities. Please feel free to contribute or use this as a starting point for your own projects! The codebase will remain in flux and will evolve with Mojo as future releases are created.
- First, you'll need to configure your
mojoproject.tomlfile to include my Conda channel. Add"https://repo.prefix.dev/mojo-community"to the list of channels. - Next, add
gojoto your project's dependencies by runningmagic add gojo. - Finally, run
magic installto install ingojo. You should see the.mojopkgfiles in$CONDA_PREFIX/lib/mojo/.
All of these packages are partially implemented and do not support unicode characters until Mojo supports them.
bufioReader: Bufferedio.ReaderScanner: Scanner interface to read data via tokens.
bytesBuffer: Buffer backed byUnsafePointer[UInt8].Reader: Reader backed byUnsafePointer[UInt8].
io- Traits:
Reader,Writer,Seeker,Closer,ReadWriter,ReadCloser,WriteCloser,ReadWriteCloser,ReadSeeker,ReadSeekCloser,WriteSeeker,ReadWriteSeeker,ReaderFrom,WriterReadFrom,WriterTo,ReaderWriteTo,ReaderAt,WriterAt,ByteReader,ByteScanner,ByteWriter,StringWriter ReaderandWriterwrapper functions.FileWrapper:FileHandleWrapper Reader/WriterSTDOUT/STDERRWriter (leveraginglibc).
- Traits:
stringsStringBuilder: String builder for fast string concatenation.Reader: String reader.
fmt- Basic
sprintffunction.
- Basic
syscall- External call wrappers for
libcfunctions and types.
- External call wrappers for
netSocket: WrapsFileDescriptorand implements network specific functions.FileDescriptor: File Descriptor wrapper that implementsio.Writer,io.Reader, andio.Closer.DialandListenfunctions. (for TCP and UDP only atm).
Please check out the test, examples, and benchmarks directories for usage of the various packages!
weave: A collection of (ANSI-sequence aware) text reflow operations & algorithms. Link to the project.mog: Terminal text styling library. Link to the project.stump: Bound Logger library. Link to the project.prism: CLI Library. Link to the project.
lightbug_http: Simple and fast HTTP framework for Mojo! 🔥 Link to the project.