Go: Difference between revisions

61 bytes added ,  29 days ago
m
[unchecked revision][unchecked revision]
(stfu)
 
(One intermediate revision by one other user not shown)
Line 1:
{{stub}}
'''Go''' (also called '''Go-lang''') is a language developed at Google. It was never designed to be a bare metal language, but with some tricks you can compile a kernel with it.
 
== Operating System Development ==
 
Go has a comparable amount of runtime to C and C++, and the language needs some callbacks in order to work. Most notably Go can't convert an integer into a pointer (which is trivial in C and very important in a kernel), you'll have to write a small Assembly wrapper for that. Expect the need for creating wrappers just like that to workaround the language and make suitable for bare metal. Some of the projects below simply use [[C]] for the parts which cannot be written in Go natively ([[GRUB|Multiboot header]] being one of them).
 
Details were discussed at GolangUK2017 talk "Bare Metal Gophers: Can you write a kernel in Go?", see [https://speakerdeck.com/achilleasa/bare-metal-gophers-can-you-write-an-os-kernel-in-go slides here].
 
== Projects ==
 
* [https://github.com/achilleasa/bare-metal-gophers Bare Metal Gophers] - code repository for the talk (does not compile with latest Go compiler)
* [https://github.com/icexin/eggos EggOS] - a fairly complete environment to run Go applications on bare metal (some parts written in C)
* [https://github.com/tgascoigne/goose Goose] - the bare minimum environment and a protected mode "Hello World" kernel in Go
* [https://gitlab.com/bztsrc/bootboot/tree/master/mykernel/go mykernel] a simplistic, long mode "Hello World" kernel in Go
 
== See Also ==
 
* [[Go Bare Bones]]
* [[BOOTBOOT]] loader has an example 64 bit higher half kernel in Go
 
== External Links ==
* [https://golang.org/ Go homepage]
* [https://speakerdeck.com/achilleasa/bare-metal-gophers-can-you-write-an-os-kernel-in-go Bare Metal Gophers: Can you write a kernel in Go?]
* [https://golangnews.org/2020/10/a-go-unikernel-running-on-x86-bare-metal/ Go lang news on EggOS]
 
[[Category:Languages]]
40

edits