09+resources,+help,+variadic,+BNF,+reading+documentation
09+resources,+help,+variadic,+BNF,+reading+documentation
Preview ■
■
go help [topic]
go help examples:
● go help env
● learning golang from golang.org ○ variadic
○ http://golang.org/doc/ ■ ...
■ https://golang.org/doc/install ○ BNF / EBNF
■ https://golang.org/ref/spec ■ Backus Naur Form
■ https://tour.golang.org/welcome/1 ■ Extended Backus
■ https://golang.org/doc/code.html Naur Form
■ https://golang.org/doc/effective_go.html ● go help packages
■ https://blog.golang.org/ ● go help build
● go help install
○ documentation
■ godoc.org
● “imported by” example code
■ golang.org
■ godoc
● google: golang godoc
○ golang.org/x/tools/cmd/godoc
● godoc -src fmt Println
● godoc -src fmt
● godoc -http=:6060
● godoc -html fmt
● godoc -html fmt Println
● godoc -q Reader
● godoc -q Writer
● godoc -q rand
■ close server
● ctrl + c
■ http://go-search.org/
resources
https://www.golang-book.com/
https://gobyexample.com/
https://www.manning.com/books/go-in-action
https://golang.org/
https://tour.golang.org/welcome/1
http://golangweekly.com/
learning golang
from golang.org
tall
ins
e go ...
iv t
f ect st ye
ef t ju
o
tn
bu
c
pe
ges
g ua
lan
f go this
r o aw
tou dy s
a
alre
we
go
w rite
o
ow t code
h
o w … go
N tive
ec
eff
https://golang.org/doc/effective_go.html
g
o blo
th eg
https://golang.org/doc/#articles
getting help
go help
review
Why doesn’t this work?
d ]
a n
m m
[ c o ]
lp p i c
h e [ t o
go help
go
Go Variadic
To understand what this means We
bo nee
th
BN d t o
F & und
va ers
ria tan
dic d
Go Variadic
bnf
Backus-Naur Form
Backus Naur Form
● Udacity Grammar
● Udacity BNF
○ and on udacity:
■ grammar
■ BNF
■ BNF Quiz
● 0612 TV BNF
● Wikipedia BNF
● Wikipedia EBNF
Backus Naur Form
● Udacity Grammar
● Udacity BNF
○ and on udacity:
■ grammar
■ BNF
■ BNF Quiz
● 0612 TV BNF
● Wikipedia BNF
● Wikipedia EBNF
variadic
...params
args...
Go Variadic
variadic
Multiple parameters
Multiple arguments
Go Variadic
exercise
use “go help [topic]” at the terminal
to learn about packages
exercise
can you find online
the same information we found
using “go help [topic]” at the terminal
to learn about packages?
ot
n
d id exercise
I
can you find online
the same information we found
using “go help [topic]” at the terminal
to learn about packages?
exercise
can you find this online?
exercise
can you find this online?
ot
n
d id
I
some information is only available
at the terminal, it seems
finding information sometimes requires
digging around
exercise
use “go help [command]” at the terminal
to learn more about the build command
exercise
use “go help [command]” at the terminal
to learn more about the install command
documentation
godoc.org
vs
golang.org
vs
godoc
godoc
documentation at TERMINAL for packages written by anyone, including documentation for official SDK
golang.org
documentation for official SDK only
b oth e
, d
w are en co
b e a writt
t -
t, bu oorly d.
g rea nd p foun
s a e
h is i itten ill b
T wr w
ll-
we
documentation
godoc
o c
d I found this by googling: golang godoc
go
c
do
go
d/
ut
cm
ols/
/to
bo
/x
rg
.o
ng
a g/
go
l a
r e do
c .o
r
o tp
://
go
m ht
https://blog.golang.org/go1.5
exercise
can you find this at
the terminal?
exercise
can you find this at
ot
the terminal?
n
d id
I
exercise
just out of curiosity,
can you find more tools starting from this URL?
http://godoc.org/golang.org/x/tools/cmd/godoc
exercise
use “godoc package [name ...]”
with multiple names
exercise
use “godoc package [name ...]”
with multiple names
What are the names: functions or methods?
l
s tm
od cts
.h
m eth -st
ru
m/
n
s-o
. co eth
od
m ple /0 6/m
xa /20
11
ye
/g ob ot.c
om
p s:/ log
sp
htt rials
.b
gt uto
lan
/go
http
:/
exercise
use “godoc package [name ...]”
with multiple names
What are the names: functions or methods?
exercise
use “go doc package [name ...]”
with one name
reminder: same as finding it at godoc.org (or golang.org)