12
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GoのTips4選

Posted at

mapやsliceはnilで返すと空だとみなされる

ローカル変数でimportしたパッケージを上書きできる

これをうまくやっているのがTestify

構造体を埋め込む場合、同じ名前のフィールドを定義すると上書きできる

golintでは引数でチェックするレベルを変えられる

package main

type Session struct {
	Url string
}

func (s *Session) Open() bool {
	return true
}

func main() {
	s := Session{"https://github.com/"}
	s.Open()
}

12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?