2021/12/07
Kumpulan snippet yang biasa digunakan dalam project menggunakan golang,
Idiomatic Gunakan gofmt gofmt adalah program untuk formating digolang. Pastikan selalu ada disetiap code editor yang digunakan.
VSCode Link:
https://code.visualstudio.com/docs/languages/go Vim Link:
https://github.com/fatih/vim-go/ Buat nama receiver tetap pendek type User struct { Name string IsActive bool } // gunakan func (u User) Activated() {} // jangan gunakan func (user User) Activated() {} func (self User) Activated() {} func (this User) Activated() {} Aktifkan golangci-lint dengan revive untuk dapat pengecekan receiver-naming.
...
2021/10/15
Write Less Code, Generate More Examine the principle of [[code generation]] Code Generation adalah salah satu teknik yang powerfull dimana kita bisa sedikit menulis kode dan menbuat secara otomatis.
Discover the main parts of a code generator Who or what is a code generator? Kalau ditanya siapa? manusia atau programmer adalah code generator. Bagus dalam problem solving dan kreative. Tapi manusia juga biasanya lama kelamaan jenuh dengan melakukan tugas yang terus berulang.
...
2021/02/18
Go Version Manager adalah tools yang membantu memperbaharui Go Version.
Instalasi bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) Penggunaan $ gvm Usage: gvm [command] Description: GVM is the Go Version Manager Commands: version - print the gvm version number get - gets the latest code (for debugging) use - select a go version to use (--default to set permanently) diff - view changes to Go root help - display this usage text implode - completely remove gvm install - install go versions uninstall - uninstall go versions cross - install go cross compilers linkthis - link this directory into GOPATH list - list installed go versions listall - list available versions alias - manage go version aliases pkgset - manage go packages sets pkgenv - edit the environment for a package set Install Go $ gvm install go1.
...