> For the complete documentation index, see [llms.txt](https://lib.rjo.me/newlib/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lib.rjo.me/newlib/languages/golang.md). Agents can also search and read this documentation through its [MCP server](https://lib.rjo.me/newlib/~gitbook/mcp).

# Golang

## Golang

### Imports

`fmt` use `fmt.Println("Hello World")` to print stuff\
`reflect` use to inspect variable types

## structs

### structs as a type

Structs are data objects containing any types of data including other structs.\
There is no limit in nesting structs. Golang is not object oriented but has some feature of object oriented programming. Example:

```
type Starship struct {
    Name String
    class String
    weight int
    length float64
}
```

`Starship` is the name of the struct similiar to a class in object oriented programming languages

### Interfaces

### Method Sets

[Error Handling](https://earthly.dev/blog/golang-errors/)
