2021-07-27 20:09:06 +00:00
|
|
|
---
|
|
|
|
author: Alvie Rahman
|
|
|
|
date: \today
|
|
|
|
title: Go (golang)
|
|
|
|
---
|
|
|
|
|
|
|
|
# Getting Up to Speed With Go
|
|
|
|
|
|
|
|
Probably the most useful resoure I found was the [Tour of Go](https://tour.golang.org/).
|
|
|
|
It's easy to understand and teaches you all you need to know.
|
|
|
|
|
|
|
|
# Making a web api
|
|
|
|
|
|
|
|
> We need to memorize the `Handler` interface.
|
2021-08-04 13:23:31 +00:00
|
|
|
>
|
|
|
|
> type Handler interface {
|
|
|
|
> ServerHTTP(ResponseWriter, *Request)
|
|
|
|
> }
|
2021-07-27 20:09:06 +00:00
|
|
|
|
|
|
|
|
2021-08-04 13:23:31 +00:00
|
|
|
# `godoc` [^golang-godoc]
|
|
|
|
|
|
|
|
> Godoc parses Go source code - including comments - and produces documentation as HTML or plain
|
|
|
|
> text.
|
|
|
|
> The end result is documentation tightly coupled with the code it documents.
|
|
|
|
> For example, through godoc's web interface [which is at <http://localhost:6060> by default] you can
|
|
|
|
> navigate from a function's documentation to its implementation with one click.
|
|
|
|
|
|
|
|
## Installing godoc // `command not found: godoc`
|
|
|
|
|
|
|
|
```bash
|
|
|
|
go get golang.org/x/tools/cmd/godoc
|
|
|
|
```
|
|
|
|
|
|
|
|
[^golang-godoc]: Andrew Gerrand, 31 March 2011 --- <https://blog.golang.org/godoc>
|