Last active
January 5, 2018 07:04
-
-
Save niten2/d0fcf1fa8218b96a52eb1da1ab777406 to your computer and use it in GitHub Desktop.
go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// map == hash | |
val := make(map[string]int) | |
defer two() | |
// * - указатель - адрес, x изменяется | |
pointer (&x) - передается | |
func pointer (x *int) { *x = 2 } | |
структуры | |
type Cats struct { | |
name string | |
} | |
func (cat *Cats) test() float64 { | |
return 1 | |
} | |
bob := Cats { "zzz" } | |
bob.test() | |
for x := range cannel { | |
x | |
} | |
if name, ok := elements["Un"]; ok { | |
fmt.Println(name, ok) | |
} | |
panic | |
recover | |
go get -u all | |
go get ./... | |
bee pack | |
nohup ./beepkg & | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
goconvey | |
"reflect" | |
fmt.Println(reflect.TypeOf(ID)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MOCK | |
var fs fileSystem = osFS{} | |
type fileSystem interface { | |
Open(name string) (file, error) | |
Stat(name string) (os.FileInfo, error) | |
} | |
type file interface { | |
io.Closer | |
io.Reader | |
io.ReaderAt | |
io.Seeker | |
Stat() (os.FileInfo, error) | |
} | |
// osFS implements fileSystem using the local disk. | |
type osFS struct{} | |
func (osFS) Open(name string) (file, error) { return os.Open(name) } | |
func (osFS) Stat(name string) (os.FileInfo, error) { return os.Stat(name) } | |
"github.com/mailgun/godebug" | |
godebug test | |
go test -v ./... | |
go test -run=TestQueryGraphql | |
http://localhost:8000/v1?query={products{id,name}} | |
for key, value := range res.DAta { | |
fmt.Println(key, value) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment