diff --git a/go/web-basics/README.md b/go/web-basics/README.md index 094699f..5f8504a 100644 --- a/go/web-basics/README.md +++ b/go/web-basics/README.md @@ -14,14 +14,16 @@ The talk requires Go to run and view. ```sh go install golang.org/x/tools/cmd/present -present +present -notes ``` -Then open [localhost:3999][localhost] in your browser. +Then open [localhost:3999/main.slide][localhost] in your browser. Press `n` to open +slide notes in a new window. -[localhost]: http://localhost:3999 +[localhost]: http://localhost:3999/main.slide ### Usage + Use the arrow keys, enter, or space to navigate with the keyboard. You can also click the margins of the slides to go back and forward. @@ -45,6 +47,7 @@ slideshow. In these slides, I've placed the command you should paste into your terminal in order to execute the demonstration. ### Editing + See the documentation for the [`present`][present-pkg] package (not to be confused with the `present` command linked above) for details on the syntax of `.slide` files. diff --git a/go/web-basics/interface/main.go b/go/web-basics/interface/main.go index 86312e4..0143720 100644 --- a/go/web-basics/interface/main.go +++ b/go/web-basics/interface/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/glacials/mainframe/talks/everyday-go/v4/interface/user" + "github.com/glacials/talks/go/web-basics/interface/user" ) // main.go diff --git a/go/web-basics/main.slide b/go/web-basics/main.slide index 2a442d5..5e2c8e9 100644 --- a/go/web-basics/main.slide +++ b/go/web-basics/main.slide @@ -8,20 +8,15 @@ : - Use the bathroom : - Shut your window -May 2020 Tags: go Summary: An introduction to using Go to build web services. -Ben Carlsson -Senior Software Engineer, YourBase +Benjamin Carlsson +Principal Software Engineer, SunPower ben@twos.dev twos.dev @glcls -: YourBase pitch: -: Ship code faster with consistency across all teams. -: A simplified build system and test accelerator for complex code bases. - ## Handler basics .code -edit handler/main.go @@ -76,9 +71,13 @@ Go has first class support for: .code -edit testing/person_test.go /\/\//, go test ./... +: Testing is dead simple, you just call the function you want to test. + ## go fmt vim gofmt/main.go +: EXIT THE PRESENTATION AND RUN THIS COMMAND + ## Exporting .play -edit exporting/person.go @@ -92,32 +91,33 @@ Run: Open: -.link http://localhost:6060/pkg/github.com/glacials/mainframe/talks/everyday-go/v4/doc/ localhost:6060 +.link http://localhost:6060/pkg/github.com/glacials/talks/go/web-basics/doc/ localhost:6060 Run: - vim ~/go/src/github.com/glacials/mainframe/talks/everyday-go/v4/doc/person.go + vim ~/go/src/github.com/glacials/talks/go/web-basics/doc/person.go ## Packages and directories - ~/ - go/ # $GOPATH - src/ - golang.org/ - x/ - tools/ - playground/ - socket/ - present/ + /path/to/my/project/ + golang.org/ + x/ + tools/ + playground/ + socket/ + present/ // main.go import "golang.org/x/tools/playground/socket" -: Mention $GOPATH. +: A package is a directory : Packages can have subpackages. : Importing a package imports all files in it. Files are arbitrary division lines to help YOU. -: This tool (`present`) itself imports golang.org/x/tools/playground/socket +: ~All packages can be imported by others, no bundling process. +: In other languages you might extract shared libraries to a common space; in Go you'll +: often import a package directly from an application repo. +: e.g. this tool (`present`) itself imports golang.org/x/tools/playground/socket ## Return values .play -edit return/main.go @@ -125,7 +125,6 @@ Run: .link https://pkg.go.dev/os?tab=doc#Open os.Open .link https://pkg.go.dev/io?tab=doc#Reader io.Reader -: Types come after the variable name in declarations. : Go is a strongly, statically typed language. : Mention io.Copy, io.Reader, io.Writer WITHOUT saying their names, to lead into interfaces. : io.Reader/Writer work on S3, files, network streams, stdout, etc. @@ -134,6 +133,7 @@ Run: .play -edit type/main.go +: Types come after the variable name in declarations. : Untyped string constant ## struct @@ -175,6 +175,7 @@ Run: : Goroutines are cheap. : You can have hundreds of thousands on one box with no noticeable performance decrease. +: Show that this program blocks by default, then write `go ` in front of `sendEmail()`. : Mention things built on top of them: : http.Handler, @@ -188,7 +189,3 @@ Run: : - map[string]struct{} : - Generics : - iota - -: Ship code faster with consistency across all teams. - -: A simplified build system and test accelerator for complex code bases.