READMEã«pkg.go.devã®ããã¸ãè²¼ã
godoc.orgã¯pkg.go.devã«ç§»è¡ãã¦ãããã¨ãåç¥ããã¦ããã®ã§ãæ°ããããã¸ã§ã¯ãã§ã¯README.mdã«è²¼ã£ã¦ããããã¸ã移è¡ãã¾ããããpkg.go.devã®URLãããã¸ã¯
// ãã㸠https://pkg.go.dev/badge/<package path> // ãªã³ã¯ https://pkg.go.dev/<package path>
ã®å½¢ãåãã¾ããä¾ãã°github.com/lufia/backoffã®å ´åã¯ä»¥ä¸ã®ããã«æ¸ãã¾ãã
# Backoff ...summary... [![GoDev][godev-image]][godev-url] ...description... [godev-image]: https://pkg.go.dev/badge/github.com/lufia/backoff [godev-url]: https://pkg.go.dev/github.com/lufia/backoff
pkg.go.devã®ãã¼ã¸ã§ã³ãæ´æ°ãã
GitHubãªã©ã§æ°ããã¿ã°ãpushãã¦ããä½ãããªããã°(å°ãªãã¨ãæ°æ¥ã¯)ã¢ã¸ã¥ã¼ã«ã¤ã³ããã¯ã¹ã«åæ ããã¾ãããããã«æ´æ°ãããå ´åãææ°ãã¼ã¸ã§ã³ãæè¨ãã¦go get
ãã¦ããã¾ãããã
// ã¢ã¯ã»ã¹ããã°ããã®ã§-dãªãã·ã§ã³ãã¤ãã¦ããã % go get github.com/lufia/backoff@v1.3.0
ããã§æ°æéå¾ã«ã¯åæ ãããã¯ãã§ããã¢ã¸ã¥ã¼ã«ã®åä½ã¯ä»¥ä¸ã®è¨äºãã¨ã¦ã詳ããã®ã§èªãã§ããã¨ãããããã¾ãã
Goãã¤ããªã®ã©ã³ã¿ã¤ã ãã¼ã¸ã§ã³ã調ã¹ã
runtime.Versionã使ãã¨ãGoã§ãã«ããããã³ãã³ãèªèº«ã¯ãã©ã®ãã¼ã¸ã§ã³ã§ãã«ããããã®ããå®è¡æã«èª¿ã¹ããã¨ãã§ãã¾ããããã¡ã¤ã«åãæå®ãã¦èª¿ã¹ãæ¹æ³ã¯(å°ãªãã¨ãç°¡åã«èª¿ã¹ãæ¹æ³ã¯)æä¾ããã¦ãã¾ããã§ããã
// èªèº«ã®ã©ã³ã¿ã¤ã ãã¼ã¸ã§ã³ããåããªã fmt.Println("Version:", runtime.Version())
Go 1.13ãããgo version
ã³ãã³ãã«-m
ãªãã·ã§ã³ã追å ããã¾ããããã®ã³ãã³ãã«å®è¡ãã¡ã¤ã«ã渡ãã¨ãã©ã®ãã¼ã¸ã§ã³ã§ãã«ããããã®ãã調ã¹ãããããã«ãªãã¾ãããã¢ã¸ã¥ã¼ã«ã使ããã¦ããå ´åã¯ãã¢ã¸ã¥ã¼ã«ã®ãã¼ã¸ã§ã³ã調ã¹ããã¾ããã¾ãããã£ã¬ã¯ããªã渡ããå ´åã¯ããã£ã¬ã¯ããªã«å«ã¾ãããGoãã¤ããªå
¨ã¦ã調ã¹ã¾ãã
% go version -m ~/bin/act /Users/lufia/bin/act: go1.14.6 path github.com/nektos/act mod github.com/nektos/act v0.2.10 h1:aMSXUGybVyLIqe3ak9GyCtRVpBxwAiSBR5stqas0lj0= dep github.com/MichaelTJones/walk v0.0.0-20161122175330-4748e29d5718 h1:FSsoaa1q4jAaeiAUxf9H0PgFP7eA/UL6c3PdJH+nMN4= dep github.com/andreaskoch/go-fswatch v1.0.0 h1:la8nP/HiaFCxP2IM6NZNUCoxgLWuyNFgH0RligBbnJU= dep github.com/containerd/containerd v1.3.3 h1:LoIzb5y9x5l8VKAlyrbusNPXqBY0+kviRloxFUMFwKc= dep github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc h1:TP+534wVlf61smEIq1nwLLAjQVEK2EADoW3CX9AuT+8= dep github.com/docker/cli v0.0.0-20190822175708-578ab52ece34 h1:H/dVI9lW9zuagcDsmBz2cj8E8paBX5FarjO7oQCpbVA= dep github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= dep github.com/docker/docker v0.0.0-20200229013735-71373c6105e3 h1:hq9QaRK9JJOg7GItpuSSA3MrBoEN3c3llxQappEq9Zo= ...
1.13ããåã®ãã¼ã¸ã§ã³ã§ãã«ãããã³ãã³ãã¯ãã©ã³ã¿ã¤ã ã®ãã¼ã¸ã§ã³ã ããªãgoversionã§èª¿ã¹ããã¾ãããã¡ããgo version
ã¨åæ§ã«ããã£ã¬ã¯ããªã渡ãã¾ãã
% go get github.com/rsc/goversion % goversion ~/bin
ãã£ãã«ã®ã¹ã©ã¤ã¹ã§selectãã
åçã«å¢æ¸ããè¤æ°ã®ãã£ãã«ã使ã£ã¦ãã©ãã§ãããã®ã§éä¿¡å¯è½ã«ãªã£ããã£ãã«ã¸ãã¼ã¿ãéããã¾ãã¯åä¿¡å¯è½ãªãã¼ã¿ãåãåºãåä½ãå®è£ ãããå ´åã«reflect.Selectã使ãã¾ãã以ä¸ã®ä¾ã¯åä¿¡ããè¡ã£ã¦ãã¾ããããã ãããã®ä½¿ãæ¹ã¯ãããªé°å²æ°ã
package main import ( "fmt" "math/rand" "reflect" "time" ) func main() { rand.Seed(time.Now().UnixNano()) a := make([]chan int, 5) for i := 0; i < len(a); i++ { a[i] = make(chan int) } cases := make([]reflect.SelectCase, len(a)) for i, c := range a { cases[i] = reflect.SelectCase{ Dir: reflect.SelectRecv, Chan: reflect.ValueOf(c), } } const N = 10 go func() { for i := 0; i < N; i++ { off := rand.Int() % len(a) a[off] <- i } }() for i := 0; i < N; i++ { // casesã«å«ã¾ãããã£ãã«ã®ã©ããã«ãã¼ã¿ãå±ãããSelectãæãã off, v, ok := reflect.Select(cases) fmt.Println(off, v, ok) } }
ã¨ããã§ãGoã®å身ã¨ãªãè¨èªã«ã¯ãããã£ãæ©è½ãè¨èªä»æ§ã«çãè¾¼ã¾ãã¦ããã®ã§ãããGoã§ã¯æå³çã«å¤ãããããã§ãããªã®ã§åé¿ã§ãããªã使ããªãæ¹ãè¯ãã®ããããã¾ããã代ããã«ãä¾ãã°chan chan int
ã®ããã«ãã£ãã«ãéåä¿¡ãããã£ãã«ã使ãã¨ãåããããªãã¨ã¯ã§ãã¾ãã
runtime.GOOSã¨build constraintsã®ã©ã£ã¡ã使ã
golang-nutsããã
all.bashã®ã¿ã¤ã ã¢ã¦ã
Goãã½ã¼ã¹ããã³ã³ãã¤ã«ããã¨ããã¹ããå®è¡ãã¾ããããã®ãã¹ãã¯10åå¼±ã§ã¿ã¤ã ã¢ã¦ããã¾ãããã·ã³æ§è½ãæªãã¿ã¤ã ã¢ã¦ããã¦ãã¾ãå ´åãç°å¢å¤æ°GO_TEST_TIMEOUT_SCALEã«2ãè¨å®ããã¨ãã¿ã¤ã ã¢ã¦ããæ¨æºã®2åã«ãªãã¾ããPlan 9ã§ã®ãã¹ãã¯ä¸é¨ã¨ã¦ãé ããã®ãããã®ã§ããã®è¨å®ãå¿ è¦ã§ãã
presentã¹ã©ã¤ã
Goé¢é£ã®çºè¡¨ã§ãã使ããããããã¹ããæ¸ãã¨ã¹ã©ã¤ãã«ãã¦ãããpresentã¨ãããã¼ã«*1ãããã®ã§ããã以åã¯ç¬ç¹ãªè¨æ³ã§æ¸ãå¿ è¦ãããã¾ãããæè¿ãã®è¨æ³ããMarkdownã«ä¼¼ããã®ã«å¤æ´ãããããã§ãã
ã¨ã¯ãããä»ãå¤ãè¨æ³ã«å¯¾å¿ãã¦ãã¦ãã©ã£ã¡ã®è¨æ³ã使ãã®ãã¯ãããã¹ãä¸ã«#
(ã¹ãã¼ã¹ãå«ã)ã1ã¤ã§ãããã°Markdown風ã®è¨æ³ã使ããã¾ãã
ãã ããtalks.godoc.orgã¯ã¾ã æ°ããè¨æ³ã«å¯¾å¿ãã¦ãã¾ããã