Upgrade to Pro — share decks privately, control downloads, hide ads and more …

golang tokyo go tools

6fd3393d5aa1e7eeeeb6d5537e698e48?s=47 mom0tomo
April 19, 2019

golang tokyo go tools

6fd3393d5aa1e7eeeeb6d5537e698e48?s=128

mom0tomo

April 19, 2019
Tweet

Transcript

  1. Go Λ͸͡ΊΔʹ͋ͨͬͯ ஌͓͍ͬͯͯ΄͍͠πʔϧ 2019/04/19 @golang.tokyo 1 The Go gopher was

    designed by Renee French.
  2. Who? • ެ຿һʢࢁܗݝிʣ
 →WebσβΠφʔ
 →αʔόʔαΠυΤϯδχΞ w Women Who Go Tokyoελοϑ

    !2 ID: mom0tomo
  3. Women Who Go Tokyo Go޷͖͕ू·ͬͯɺ݄ʹҰ౓ςʔϚֶश͍ͯ͠·͢ !3

  4. ΩʔΩϟοϓ൦෍͠·ͨ͠ ٕज़ॻయ#wwg_tokyo !4

  5. ஌͓ͬͯ͘ͱ ໾ʹཱͭ͜ͱ !5

  6. golang.orgΛࢀর͠Α͏ !6

  7. golang.orgΛࢀর͠Α͏ golang.jp͸಺༰͕WҎલͳͷͰ஫ҙ͢Δ !7

  8. Gophers.slack.comʹࢀՃ͠Α͏ !8

  9. Gophers.slack.comʹࢀՃ͠Α͏ https://invite.slack.golangbridge.org/ !9

  10. Golang WeeklyΛಡ΋͏ !10

  11. !11 ஌͍ͬͯΔͱ ศརͳπʔϧ

  12. Go ͸ίϚϯυ/πʔϧ͕ॆ࣮ͯ͠ ͍Δ • go ίϚϯυ • go tool •

    ඪ४ɾ४ඪ४ύοέʔδͰఏڙ͞Ε͍ͯΔ • IDEʹཔΒͳͯ͘΋շదʹ։ൃͰ͖Δ
  13. ؀ڥม਺Λදࣔ͢Δ $ go env 13

  14. $ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/alex/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux"

    GOOS="linux" GOPATH="/home/alex/go" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go- build245740092=/tmp/go-build -gno-record-gcc-switches" 14
  15. $ go env GOPATH GOROOT /Users/mom0tomo/dev/go /usr/local/go // ಛఆͷ؀ڥม਺Λൈ͖ग़ͯ͠දࣔ͢Δ 15

  16. ίʔυΛformat͢Δ $ gofmt $ go fmt 16

  17. $ gofmt . $ gofmt foo.go // Options // -d

    : diffΛඪ४ग़ྗ͢Δ // -l : ϑΝΠϧ໊Λඪ४ग़ྗ͢Δ // -w : ্ॻ͖อଘ͢Δ // -s : ه๏Λγϯϓϧʹ͢Δ // Ұཡ͸ https://godoc.org/github.com/gophersjp/go/src/cmd/gofmt 17
  18. $ go fmt . $ go fmt foo.go // $

    gofmt -l -w ͱಉ͡͸ͨΒ͖ // formatͨ͠಺༰Ͱ্ॻ͖ͯ͠ϑΝΠϧ໊Λඪ४ग़ྗ͢Δ 18
  19. ίʔυΛ੩తղੳͯ͠ ଥ౰ੑΛνΣοΫ͢Δ $ go vet 19

  20. $ go vet . $ go vet foo.go // ίʔυΛ੩తղੳͯ͠ه๏ΛνΣοΫ͢Δ

    // ίϯύΠϥʹ͸ݕ஌Ͱ͖ͳ͍΋ͷΛݟ͚ͭͯ͘ΕΔ 20
  21. Ϧϯλʔʹ͔͚Δ $ golint 21

  22. $ golint . $ golint foo.go // ίʔυ͕Effective GoͱCodeReviewCommentsʹ Ԋ͏͔νΣοΫ͢Δ

    22
  23. Thank you! @mom0tomo 23