Go
programming language
https://github.com/golang/go/wiki#learning-more-about-go
https://talks.golang.org/2014/go4gophers.slide#2
https://go-proverbs.github.io/
https://zenn.dev/spiegel/articles/20201212-method-value-and-expression
「Go初心者が気を付けること」の解説
Go go-to guide · YourBasic
enocom/gopher-reading-list: A curated selection of blog posts on Go
The Go Programming Language Specification - The Go Programming Language
Go Codereview Comments JP
https://github.com/golang/go/wiki/CodeReviewComments#initialisms
guide/style.md at master · uber-go/guide
Goa :: Design first.
Zig Makes Go Cross Compilation Just Work - DEV Community
Version manage by asdf
code:terminal
asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
asdf list all golang
asdf install golang 1.17.6
asdf local golang 1.17.6 // .tool-version will be created
go vet
Go method receiver
Go pointer
Log
基本は先頭を大文字にしない
https://knsh14.github.io/translations/go-codereview-comments/#error-strings
How to start project
特に cargo new みたいなコマンドはない
main.go をつくれば ok
goenv local 1.16.0
formatter
gofmt, goimports, goreturns — why do we need three formatters?!
Go module
1.13 以降はデフォルトでオン
それ以前は GO111MODULE 環境変数を設定する
vendor
vendor ないの module を触って debug するときは
code:terminal
$ go run -mod=vendor main.go
goroot, gopath
goroot は パッケージなどのインストール先で異なる go のバージョンを使う場合に使われる?
gopath はプロジェクトの配置先
https://pleiades.io/help/go/configuring-goroot-and-gopath.html
Go 使っている企業
Go のGCのオーバーヘッドが高くなるケースと、その回避策 - Qiita
Goにおけるポインタの使いどころ
Projects
palantir/godel: Go tool for formatting, checking, building, distributing and publishing projects
palantir/goastwriter: Go library for writing Go source code programatically
uber-go/gopatch: Refactoring and code transformation tool for Go.
Tips
構造体の初期化は、フィールド名も明示する
構造体のフィールドが増えたときに、フィールド名がついていない場合コンパイルされない?
omitempty
struct を omit するには nil にする
Structをomitemptyする方法 - Qiita
配列
len 0、nil なら消える?
中の要素が nil であることと len は関係ない?
値を 0 で初期化すればいいかもしれない
struct の初期化???
code:main.go
type Employee struct {
name: string
}
var tom Employee
alice := Employee{}
tom.name = 'Tom'
alice.name = 'Alice'