|
You are here |
blog.nuculabs.de | ||
| | | | |
www.integralist.co.uk
|
|
| | | | | The following code doesn't do what you might expect: package main import "fmt" func main() { var i *impl fmt.Println("i == nil:", i == nil) what(i) } type impl struct{} func (i *impl) do() {} func what(i interface{ do() }) { fmt.Println("i == nil:", i == nil) } If you expected the what function to print i == nil: true, then keep reading... Typed Nils The behavior observed is due to the way interfaces and nil values interact in Go. | |
| | | | |
infinitedigits.co
|
|
| | | | | Exploring meta-behaviors. | |
| | | | |
hjr265.me
|
|
| | | | | I have been meaning to do a few short-form blog posts lately. This blog post is going to be one of them. In Go, on Linux, if you want to know when the terminal window is resized, you can listen for the SIGWINCH signal using the signal.Notify (or the signal.NotifyContext) function. The code will look something like this: 1 2 3 4 5 ch := make(chan os.Signal) signal.Notify(ch, syscall.SIGWINCH) for range ch { // The terminal has been resized. | |
| | | | |
www.thepolyglotdeveloper.com
|
|
| | | Learn about GraphQL and how to use it to query for data in Golang without creating numerous RESTful API endpoints. | ||