Learn How To Code: Google's Go (golang) Programming Language
4.6 (3,529 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
49,363 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Learn How To Code: Google's Go (golang) Programming Language to your Wishlist.

Add to Wishlist

Learn How To Code: Google's Go (golang) Programming Language

Learn programming from a University Professor in Computer Science with over 15 years of teaching experience.
Bestselling
4.6 (3,529 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
49,363 students enrolled
Created by Todd McLeod
Last updated 5/2017
English
Current price: $10 Original price: $35 Discount: 71% off
1 day left at this price!
30-Day Money-Back Guarantee
Includes:
  • 21 hours on-demand video
  • 4 Articles
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Learn how computers work
  • Learn the fundamentals of programming
  • Learn modern best-practices for programming
  • Learn from a University Professor in Computer Science with over 15 years of experience teaching individuals of all ability levels
  • Understand why the Go programming language is the best programming language you can learn today
  • Acquire additional valuable programming skills including understanding environment variables, using a command line interface (CLI) terminal, understanding SHA-1 checksums, working with GitHub, and increasing your productivity with an integrated development environment (IDE) such as Webstorm or Atom.io
View Curriculum
Requirements
  • No prerequisite knowledge is required to take this course. This course starts at the very beginning and will teach you everything you need to know to be an outstanding programmer.
Description

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Go is an amazing choice for a language as it was developed by some of the same individuals who created the C programming language, Unix, and UTF-8 - some of the most influential contributions to computer science. Robert Griesemer, Rob Pike, and Ken Thompson created Go to be a modern language that easily uses multiple cores, easily implements concurrency, easily works in distributed environments, and easily allows the programmer to write programs - it has a very lean and user-friendly syntax.

Go was created by luminaries in computer science at one of the best, if not the very best, software engineering firm to have ever existed - Google.

The credentials of Go are unsurpassed.

But why did Google create a new language?

In Google’s words, “Go was born out of frustration with existing languages and environments for systems programming. Programming had become too difficult and the choice of languages was partly to blame. One had to choose either efficient compilation, efficient execution, or ease of programming; all three were not available in the same mainstream language. Programmers who could were choosing ease over safety and efficiency by moving to dynamically typed languages such as Python and JavaScript rather than C++ or, to a lesser extent, Java. Go is an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language. It also aims to be modern, with support for networked and multicore computing. Finally, working with Go is intended to be fast: it should take at most a few seconds to build a large executable on a single computer. To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools; a new language was called for.”

In my opinion, Go is the best programming language that you can be learning today. I began programming in 1982 with BASIC, I have worked with many languages, and Go is the best language which I have ever used. Go is also the top-paid programming language in America today.

Come learn about the greatest programming language ever created. You will leave with resources and code samples to start making all of your software and apps really go.

Who is the target audience?
  • This is a first semester university level programming course.
  • This course is ideal for beginners wanting to learn programming.
  • This course is perfect for experienced programmers wanting a thorough introduction to the Go programming language.
  • This course is perfect for experienced programmers wanting to fill in gaps in their programming knowledge.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
169 Lectures
21:10:23
+
Introduction
3 Lectures 29:16

Gain access to many valuable learning resources: accessing github code samples, accessing powerpoint presentations used in my college and university go programming classes, accessing my other training videos for free, staying abreast of other great learning resources by following me on Twitter Todd McLeod

  • HERE ARE THE RESOURCES: https://goo.gl/PHKgO7
  • Resources
  • Github code samples
    • downloading zip
    • searching for code
  • Powerpoint presentations
  • Youtube Todd McLeod
  • Bill Kennedy’s book
  • Donovan and Kernighan’s book
  • Caleb Doxsey’s book
  • go by example
  • language spec
  • effective go
Preview 07:24

Comparing today's programming languages; the credentials of the Go programming language; reasons for choosing Go; companies using Go; people using Go (bye bye node.js); an example of the server load carried by a Chinese company using the Go programming language.

Why choose the Go programming language?
12:15

Hello World; basic program structure; the go playground; packages; standard library; golang.org; godoc.org;

code: https://play.golang.org/p/04Qiz0BH4N

  • hello world
    • go playground
      • formatting code
      • sharing code
      • run code
  • packages
    • code that is already written which you can use
    • imports
      • (importing a package)
  • documentation
    • golang.org
      • standard library
      • src
    • godoc.org
      • standard library AND third-party package
Hello World!
09:37
+
Installing Go
13 Lectures 02:09:16
A preview of what we’re going to cover in this section: overview of the Go installation process; GUI’s versus command line; command prompt vs terminal; DOS commands vs Unix commands; SHA1, hash algorithm checksums; the importance of having your workspace configured correctly; namespacing in go; you will learn how to configure either a windows machine or a mac in this section.
Section Overview
03:12

terminal emulator - github

Download github and change the settings to enable the “git bash” terminal so that we can run Unix terminal commands on a Windows machine.

  • download github for windows
  • open settings
  • choose “git bash”
  • open it and test it
  • basic terminal commands
  • ls
    • ls -la
  • cd
  • cd ../
  • pwd
The Terminal
06:13

download go; run sha1 checksum openssl sha1; uninstall any old versions; install new version

  • download go
  • sha1 checksum
  • uninstall old version
  • install new version
  • go version
Installation Insights
08:48

Learn the importance of your Go workspace. Learn how to configure your Go workspace. Learn about namespacing, the importance of namespacing, and how Go implements namespacing.

  • one folder - any name, any location
    • bin
    • pkg
    • src
      • github.com
        • <github.com username>
          • folder with code for project / repo
          • folder with code for project / repo
          • folder with code for project / repo
          • folder with code for project / repo
          • ...
          • folder with code for project / repo
  • namespacing
  • go get
    • package management
Go Workspace
08:48

An explanation of environment variables.

Environment Variables
06:51

  • computer / properties / advanced system settings / environment variables /
    • googling for location on different windows versions
    • search box in windows
  • user variables vs system variables
  • GOPATH
    • copying the path from windows explorer
  • Setting a PATH variable to your bin
Windows - Configuring Path Variables
08:01

  • spotlight search
  • terminal
  • cd ~
    • users home
  • ls -la
  • hidden files
  • .bash_profile
  • .bashrc
  • nano
Mac - Configuring Path Variables
10:23

IMPORTANT - REGARDING LINUX VIDEOS THAT FOLLOW
00:21

  • This video is a lecture by a guest speaker at my CSU Fresno class. It covers:
    • setup a linux machine
    • use a linux machine on digital ocean
    • SSH
    INSTRUCTIONS:
    https://github.com/GoesToEleven/GolangTraining/tree/master/27_code-in-process/67_digital-ocean_aerospike
Linux - Machine Setup
33:39

This video is a lecture by a guest speaker at my CSU Fresno class.

INSTRUCTIONS:

https://github.com/GoesToEleven/GolangTraining/tree/master/27_code-in-process/67_digital-ocean_aerospike

Linux - Machine Configuration
12:43

This lecture is from a guest speaker in my CSU Fresno class.

INSTRUCTIONS:

https://github.com/GoesToEleven/GolangTraining/tree/master/67_digital-ocean_aerospike

Linux - Configuring Path Variables
21:41

Test your installation and, at the same time, get all of the sample code used in this training!

Testing Your Installation
04:32

  • github terminal emulator
  • basic terminal commands
  • ls -la
  • cd
  • cd ../
  • pwd
  • env
  • sha1 checksum
  • go command
    • go
    • go version
    • go env
    • go get
  • Go workspace
    • bin
    • pkg
    • src
      • github.com
        • <github.com username>
          • folder with code for project / repo
  • GOPATH
  • GOROOT
  • namespacing
  • environment path variables

using go get to get the code used in this course

Section Review
04:04
+
Your Development Environment
10 Lectures 01:06:21
  • IDE’s (integrated development environment)
    • WebStorm
    • Atom
  • Configuring Webstorm
  • Using Webstorm
  • go run, go build, go install
  • Understanding Github
  • Creating Your Own Repo
  • Using Github
Section Overview
01:51

  • IDE’s
  • Webstorm
    • plugins
    • golang plugin
    • creating a new project || package || library
    • GO SDK
    • themes
      • http://www.ideacolorthemes.org/home/
    • live edit
      • JETBrains IDE Support Chrome Plugin
Go Editors
09:07

  • keymap
  • I have found helpful
    • preferences
      • search (search box in preferences)
      • right margin
      • wrap, soft wraps, folding
      • emmet
    • show line numbers
    • terminal
    • local history
    • refactor / rename
    • find in path
    • reformat code
    • comment
    • surround with
    • VCS
  • ATOM
    • made by github
    • go-plus plugin
WebStorm & Atom.io
06:34

You can use WebStorm for free as a student:

https://www.jetbrains.com/student/

Free For Students - WebStorm
00:05

  • creating a folder for your code
  • opening that folder with webstorm
  • selecting the Go SDK
  • organizing your code sequentially
    • naming folders with numbers first is NOT idiomatic
  • .idea folder
    • seeing hidden files in Windows
Creating Your First Project
09:03

  • writing the program
    • code completion
  • seeing documentation and source code internals instantly within webstorm
  • terminal
    • go fmt
    • go run
  • setting your theme
Preview 08:14

  • documentation
  • go run
    • needs a file name, eg, go run main.go
  • go build
    • for an executable:
      • builds the file
      • reports errors, if any
      • if there are no errors, it puts an executable into the current folder
    • for a package:
      • builds the file
      • reports errors, if any
      • throws away binary
  • go install
    • for an executable:
      • compiles the program (builds it)
      • names the executable the folder name holding the code
      • puts the executable in workspace / bin
        • $GOPATH / bin
    • for a package:
      • compiles the package (builds it)
      • puts the executable in workspace / pkg
        • $GOPATH / pkg
      • makes it an archive file
  • go clean
The Go Command & Documentation
05:47

  • git
  • github
  • history
  • github
    • code storage
    • code sharing
    • code collaboration
    • code versions
    • code searching
    • programmer assessing
Understanding Github
07:37

  • windows
    • install git
  • Creating Your Own Repo
  • pushing code to github
    • from webstorm
    • from terminal
      • git status
      • git add --all
      • git commit -m “first commit”
        • first time - set remote repository (repo)

git remote add origin https://github.com/GoesToEleven/udemyTraining.git
git push -u origin master

  • git push
Using Github
14:23

  • IDE’s
    • webstorm
    • atom
  • Creating Your First Project
    • creating a folder for your code
    • opening that folder with webstorm
      • selecting the Go SDK
    • organizing your code sequentially
      • naming folders with numbers first is NOT idiomatic
    • .idea folder
      • seeing hidden files in Windows
  • Hello World with Webstorm
    • seeing documentation and source code internals instantly within webstorm
  • terminal
    • go fmt
    • go run
    • go build
      • for an executable:
        • builds the file
        • reports errors, if any
        • throws away binary
    • go install
      • for an executable:
        • compiles the program (builds it)
        • names the executable the folder name holding the code
        • puts the executable in workspace / bin
          • $GOPATH / bin
  • Git & Github
    • code storage, sharing, collaboration
    • code versioning, code searching
    • programmer assessing
  • Using Github
    • windows
      • install git
    • Creating Your Own Repo
    • pushing code to github
      • from webstorm
      • from terminal
        • git status
        • git add --all
        • git commit -m “first commit”
          • first time - set remote repository (repo)

git remote add origin https://github.com/GoesToEleven/udemyTraining.git
git push -u origin master

  • git push
Section Review
03:40
+
Computer Fundamentals
11 Lectures 01:30:18

This section is going to show you how computers work. You will learn the internal systems of a computer. You will learn about circuits and coding schemes. You will learn about binary, binary digits, and bits. You will learn how to measure bits. You will learn about numeral systems. You will learn how to use binary and hexadecimal. You will learn about format printing and format verbs. You will also learn about the history of computers.

Section Overview
02:03

  • CIRCUITS / SWITCHES
  • CODING SCHEMES
  • BINARY
  • 2n
  • 5 generations of computers
  • Moore's Law
How Computers Work - Part I
09:56

  • Measuring Bits
    • Bits
    • Bytes
    • KB
    • MB
    • GB
    • TB
  • Machine Language
How Computers Work - Part II
12:29

  • Housekeeping
  • terminal in webstorm is not unix based but command prompt (cmd.exe) based
  • changed github repo
    • update with:

go get -u github.com/goestoeleven/golangtraining

  • reading docs
    • go
    • go help get
Github Update Command
08:55

  • understanding numeral systems
  • common numeral systems
    • decimal
    • binary
    • hexadecimal
  • reason for different numeral systems
  • fmt.Printf and formatting verbs
Numeral Systems
04:07

  • how the binary numbering system works
  • representing quantities in binary
  • hands-on exercises
Binary Numbering System
07:40

  • how the hexadecimal numbering system works
  • representing quantities in hexadecimal
  • hands-on exercises
  • why we use different numbering systems
    • hex can represent larger quantities in less space
      • hex sometimes has this prefix: 0x
    • computers store binary numbers easily because they have switches that are either on or off
Hexadecimal Numbering System
07:08

  • hexadecimal
    • often called hex
    • sometimes has “0x” prefix indicating it’s hex
  • Octal
    • There is a base 8 numbering system called Octal
    • often called Oct
    • Question:
      • how would you represent the number 42 in Oct?
      • Why have Oct?
  • ASCII
  • UTF
Text Encoding
09:25

  • format printing
    • a program that prints a quantity in decimal
    • a program that prints a quantity in binary
    • a program that prints a quantity in hex
  • format verbs
    • %d
    • %b
    • %x
  • escape characters
    • \n
  • godoc.org documentation
Coding Scheme Programs
09:33

  • format verbs
    • %#x
    • %#X
  • escape characters
    • \t
  • a program that prints a series of numbers in decimal, binary, and hex
    • loop syntax
  • a program that prints the first 200 characters of UTF-8
    • loop syntax
Format Printing
09:46

  • Housekeeping
    • github
      • git status
      • git add --all
      • git status
      • git commit -m “adds changes to 01 getting started folder”
      • git push
  • Review
    • How computers work
      • electricity
      • circuits / switches / transistors
      • coding schemes
        • 2n
      • binary
      • binary digits = bits
      • measuring bits
        • Bits
        • Bytes
        • KB
        • MB
        • GB
        • TB
      • Machine Language
      • 5 generations of computers
        • vacuum tubes
        • transistors
        • chips
        • cpu’s
        • ???
      • Moore's Law
    • go get
      • updating a package
        • go get -u [package name]
      • reading docs
        • go
        • go help get
    • Numeral systems
      • decimal
      • binary
      • hexadecimal
      • octal
    • Text Encoding
      • ASCII
      • UTF
    • Coding Scheme Programs
      • format printing

format verbs

    • %d
    • %b
    • %x
  • escape characters
    • \n
    • \t
  • loop
    • printed a series of numbers in decimal, binary, and hex
    • printed the first 200 characters of UTF-8
Section Review
09:16
+
Language Fundamentals
17 Lectures 02:13:34
  • FYI
    • ardan labs training
  • preview
    • packages
    • variables
      • shorthand
      • var → zero value
    • scope
    • blank identifier
    • constants
    • memory addresses (pointers)
    • remainder
Section Overview
05:50

  • one folder, many files
    • package declaration in every file
    • package scope
      • something in one file is accessible to another file
    • imports have file scope
  • exported / unexported
    • aka, visible / not visible
    • we don’t say (generally speaking): public / private
    • capitalization
      • capitalize: exported, visible outside the package
      • lowercase: unexported, not visible outside the packag
Packages
07:54

  • go commands
    • go run
    • go build
    • go install
    • go clean
Go Commands
05:46

  • shorthand
    • can only be used inside func
  • var
    • zero value
  • type format verb
    • %T
  • not preferred methods
  • declare, assign, initialize
Variables
08:45

  • levels of scope
    • universe
    • package
    • file
    • block (curly braces)
  • FYI
    • {} - braces, curly braces, curlies, mustaches
    • [] - brackets
    • () - parentheses, parens
  • package level scope
    • for variables
    • not for imports
  • file level scope
    • imports
  • block level scope
  • keep your scope tight
Scope
07:50

  • an example of
    • block level scope
    • order mattering in block level scope
    • variable shadowing
Scope II
10:08

  • closure
  • variables declared in the outer scope are accessible by statements in the inner scopes which are enclosed by the outer scope
Closure
11:14

  • reading the go language specification to reconcile what we have learned with how the language specification talks about it
  • some personal information about me, the perfection of imperfection, and our collective humanity
Language Spec
10:03

  • you must use everything you put in your code
    • if you declare a variable, you must use it
  • the blank identifier
    • _
    • allows you to tell the compiler you aren’t using something
  • example
    • http.Get
    • throwing away an error
Blank Identifier
04:25

  • a simple, unchanging value
  • iota’s
    • creating constants values for
      • KB
      • MB
      • GB
      • TB
Constants
09:02

  • a simple, unchanging value
  • a parallel type system
    • C / C++ has problems with a lack of strict typing
    • in Go, there is no mixing of numeric types
  • there are TYPED and UNTYPED constants
    • const hello = "Hello, World"
    • const typedHello string = "Hello, World"
  • UNTYPED constant
    • a constant value that does not yet have a fixed type
      • a “kind”
      • not yet forced to obey the strict rules that prevent combining differently typed values
  • It is this notion of an untyped constant that makes it possible for us to use constants in Go with great freedom.
  • This is useful, for instance
    • what is the type of 42?
      • int?
      • uint?
      • float64?
    • if we didn’t have UNTYPED constants (constants of a kind), then we would have to do conversion on every literal value we used
      • and that would suck
Constants II
07:21

  • You are doing awesome
  • You are learning great things which, if not presented correctly, would have been way more challenging
Words of Encouragement
03:42

  • memory
    • memory addresses
  • Seeing a memory address
Memory Addresses
06:41

  • pointers
    • Using memory addresses in statements
  • referencing / dereferencing
Pointers
06:19

It’s all pass by value
Using Pointers
07:45

  • remainder
  • conditional logic
    • print Odd / Even
  • loop
  • encouragement
    • building skills - awesome for
      • creating / art
      • job prospects
      • supporting yourself / your loved ones
    • Maynard
      • you got it going on, baby, you got it going on
Remainder
05:46

  • ardan labs training
  • HIGH OVERVIEW
    • packages
    • variables
      • shorthand
      • var → zero value
    • scope
    • blank identifier
    • constants
    • memory addresses (pointers)
    • remainder
  • packages
    • one folder, many files
      • package declaration in every file
      • package scope
        • something in one file is accessible to another file
      • imports have file scope
    • exported / unexported
      • aka, visible / not visible
      • we don’t say (generally speaking): public / private
      • capitalization
        • capitalize: exported, visible outside the package
        • lowercase: unexported, not visible outside the package
  • go commands
    • go run
    • go build
    • go install
    • go clean
  • variables
    • shorthand
      • can only be used inside func
    • var
      • zero value
    • type format verb
      • %T
    • not preferred methods
    • declare, assign, initialize
  • scope
  • levels of scope
    • universe
    • package
    • file
    • block (curly braces)
  • FYI
    • {} - braces, curly braces, curlies, mustaches
    • [] - brackets
    • () - parentheses, parens
  • keep your scope tight
    • closure
      • variables declared in the outer scope are accessible by statements in the inner scopes which are enclosed by the outer scope
      • anonymous funcs
      • func expressions
  • Blank Identifier
    • tell the compiler you aren’t using something
      • you must use everything you put in your code
    • http.Get
      • throwing away an error
  • Constants
    • a simple, unchanging value
    • iota’s
      • creating constants values for
        • KB
        • MB
        • GB
        • TB
      • bitwise operations
    • a parallel type system
      • there are TYPED and UNTYPED constants
        • const hello = "Hello, World"
        • const typedHello string = "Hello, World”
    • UNTYPED constant
      • a constant value that does not yet have a fixed type
        • a “kind”
        • not yet forced to obey the strict rules that prevent combining differently typed values
  • Memory Addresses
    • memory
    • memory addresses
    • Seeing a memory address
  • Pointers
    • Using memory addresses in statements
    • referencing / dereferencing
    • It’s all pass by value
  • Remainder
    • remainder
    • conditional logic
      • print Odd / Even
    • loop
  • Words of Encouragement
  • You are doing awesome
  • You are learning great things which, if not presented correctly, would have been way more challenging
  • building skills - awesome for
    • creating / art
    • job prospects
    • supporting yourself / your loved ones
  • Maynard
    • you got it going on, baby, you got it going on
  • Some personal information about me, the perfection of imperfection, and our collective humanity
Section Review
15:03
+
Control Flow
11 Lectures 01:35:04
  • sequence
  • loop / iterative
    • for loop
      • init, cond, post
    • bool (while-ish)
      • infinite
    • do-while-ish
      • break
    • continue
    • nested
  • conditionals
    • switch / case / default statements
      • no default fall-through
      • creating fall-through
      • multiple cases
      • cases can be expressions
        • evaluate to true, they run
      • type
    • if
      • the not operator
        • !
      • initialization statement
      • if / else
      • if / else if / else
      • if / else if / else if / … / else
  • Exercises
Section Overview
07:04

  • resources
    • https://forum.golangbridge.org/
    • Dave Cheney
  • for loop
    • documentation
      • language spec
      • effective go
    • initialization, condition, post
For Loop
06:53

  • for loop
    • nested loops
Nested Loops
06:23

  • for loop
    • condition
    • no condition
    • break
    • continue
Conditions, Break, & Continue
07:23

  • documentation
    • golang spec
    • effective go
  • terminology
    • lexical elements
    • literal values
    • runes
  • rune
    • character
    • an integer value identifying a Unicode code point
    • alias for int32
      • how many bytes in 32 bits? (4 bytes → 4 * 8 = 32)
      • UTF-8 is a 4 byte coding scheme
      • with int32 (4 bytes) we have numbers for each of the code points
Documentation & Terminology
13:01

  • casey neistat
  • rune
  • printing UTF-8
Rune
06:23

  • using single-quotes
  • strings
    • made up of runes
String Type
10:40

  • switch / case / default statements
    • no default fall-through
    • creating fall-through
    • multiple cases
    • cases can be expressions
      • evaluate to true, they run
    • type
Switch Statements
07:27

  • the not operator
    • !
  • initialization statement
  • if / else
  • if / else if / else
  • if / else if / else if / … / else
If Statements
07:08

  • you can find the EXERCISES HERE: https://goo.gl/tGHNhA
  • exercises are presented
  • the solutions to the exercises are provided
Exercise Solutions
14:01

  • Control Flow
    • sequence
    • loop / iterative
      • nested loops
      • break
      • continue
    • conditionals
      • switch / case / default statements
        • no default fall-through
        • multiple cases
        • cases can be expressions
          • evaluate to true, they run
        • type
      • if
        • the not operator
          • !
        • initialization statement
        • if / else
        • if / else if / else
        • if / else if / else if / … / else
  • resources
    • https://forum.golangbridge.org/
    • Dave Cheney blog
  • documentation
    • language spec
    • effective go
  • terminology
    • lexical elements
    • literal values
    • runes
  • rune
    • character
    • an integer value identifying a Unicode code point
    • alias for int32
      • UTF-8 is a 4 byte coding scheme
      • with int32 (4 bytes) we have numbers for each of the code points
  • strings
    • made up of runes
  • Exercise Solutions
Section Review
08:41
+
Functions
19 Lectures 01:54:06
  • functions
    • params
      • multiple “variadic” params
    • args
      • multiple “variadic” args
    • returns
      • multiple returns
      • named returns - yuck!
    • review
      • func expressions
      • closure
    • callbacks
    • recursion
    • defer
    • anonymous self-executing functions
    • pass by value
      • reference types
    • data structures preview
      • maps
      • slices
      • structs
  • Exercises
Section Overview
01:51

  • func main
  • func syntax
    • func, receiver, identifier, params, returns
  • purpose of functions
    • abstract code
    • code reusability
  • parameters vs. arguments
  • declaring a func with multiple params
Intro To Functions
07:48

  • function syntax when declaring a func
  • a single return
  • a named return
  • multiple returns
Func Returns
05:27

a func that accepts an unlimited number of parameters
Variadic Functions
06:49

  • personal anecdote: head down, ox plowing field; doing the work
  • variadic funcs
    • my phrase: variadic parameter
    • my phrase: variadic argument
  • different ways of writing the same functionality
Variadic Arguments
05:07

assigning a func to a variable
Func Expressions
05:41

  • one scope enclosing other scopes
    • variables declared in the outer scope are accessible in inner scopes
  • closure helps us limit the scope of variables
Closure
06:04

  • passing a func as an argument
  • functional programming not something that is recommended in go, however, it is good to be aware of callbacks
  • idiomatic go: write clear, simple, readable code
Callbacks
06:49

a cool example of a callback
Callback Example
05:34

  • a func that calls itself
  • factorial example
Recursion
05:04

A "defer" statement invokes a function whose execution is deferred to the moment the surrounding function returns, either because the surrounding function executed a return statement, reached the end of its function body, or because the corresponding goroutine is panicking.
Defer
04:20

in Go, everything is pass by value
Pass By Value
06:41

  • map
  • slice
  • with reference types, you do not need to pass an address
Reference Types
05:06

Anonymous Self-Executing Functions
Anonymous Self-Executing Functions
01:39

  • expressions vs statements
  • bool types
    • true, false
  • operators
    • not

!

  • or

||

  • and

&&

Bool Expressions
07:23

  • multiple returns
  • func expression
  • variadic func
  • bool & operator
Exercises - Part I
07:46

  • variadic again
  • project euler
Exercises - Part II
06:40

https://projecteuler.net/

Exercises - Part III
07:50

  • functions
  • purpose of functions
    • abstract code
    • code reusability
      • DRY - Don’t Repeat Yourself
  • func, receiver, identifier, params, returns
  • parameters vs arguments
  • variadic funcs
    • multiple “variadic” params
    • multiple “variadic” args
  • returns
    • multiple returns
    • named returns - yuck!
  • func expressions
    • assigning a func to a variable
  • closure
    • one scope enclosing another
    • variables declared in the outer scope are accessible in inner scopes
    • closure helps us limit the scope of variables
  • callbacks
    • passing a func as an argument
  • recursion
    • factorial
  • defer
  • anonymous self-executing functions
  • pass by value
  • reference types
  • map
  • slice
  • with reference types, you do not need to pass an address
Section Review
10:27
+
Data Structures - Array
3 Lectures 25:20
  • array
    • a numbered sequence of elements of a single type
    • does not change in size
    • https://golang.org/ref/spec#Array_types
  • slice
    • a list
    • A slice is a descriptor for a contiguous segment of an underlying array and provides access to a numbered sequence of elements from that array. A slice type denotes the set of all slices of arrays of its element type. The value of an uninitialized slice is nil.
    • change in size
    • have a length and a capacity
    • multi-dimensional
    • https://golang.org/ref/spec#Slice_types
  • map
    • key / value storage
    • a “dictionary”
    • A map is an unordered group of elements of one type, called the element type, indexed by a set of unique keys of another type, called the key type. The value of an uninitialized map is nil.
    • https://golang.org/ref/spec#Map_types
  • struct
    • a data structure
    • a composite type
    • allows us to collect properties together
    • https://golang.org/ref/spec#Struct_types
Data Structures Overview
06:07

  • definition
    • An array is a numbered sequence of elements of a single type.
    • The number of elements is called the length and is never negative.
    • The length is part of the array's type; it must evaluate to a non-negative constant representable by a value of type int.
      • The length of an array a can be discovered using the built-in function len.
    • The elements can be addressed by integer indices 0 through len(a)-1.
    • Array types are always one-dimensional but may be composed to form multi-dimensional types.
    • not dynamic
      • does not change in size
  • a basic array
    • len
    • index access
    • assigning a value to an index position in an array
Array
08:28

  • understanding the difference between index position and the items stored
    • if you’re storing three items in array a, those items will be at index positions 0, 1, 2
      • len(a)-1 is your last index position
        • eg, 3-1 = 2 → 2 is your last index position for your array, a, which has three items
  • using break in a loop
Array Examples
10:45
+
Data Structures - Slice
6 Lectures 56:43
  • definition
    • A slice is a descriptor for a contiguous segment of an underlying array and provides access to a numbered sequence of elements from that array.
    • The value of an uninitialized slice is nil.
      • it is a reference type
    • Like arrays, slices are indexable and have a length.
    • The length of a slice s can be discovered by the built-in function len;
      • Unlike arrays, slices are dynamic
        • their length may change during execution.
    • The elements can be addressed by integer indices 0 through len(s)-1.
    • A slice, once initialized, is always associated with an underlying array that holds its elements.
      • it is a reference type
    • The array underlying a slice may extend past the end of the slice.
      • Capacity is a measure of that extent:
        • it is the sum of the length of the slice and the length of the array beyond the slice;
      • The capacity of a slice a can be discovered using the built-in function cap(a).
    • make
      • A new, initialized slice value for a given element type T is made using the built-in function make, which takes a slice type and parameters specifying the length and optionally the capacity.
      • A slice created with make always allocates a new, hidden array to which the returned slice value refers.
        • make([]T, length, capacity)
        • make([]int, 50, 100)
          • same as this: new([100]int)[0:50]
    • Like arrays, slices are always one-dimensional but may be composed to construct higher-dimensional objects. (multi-dimensional slices)
  • a basic slice
Slices
10:04

  • length and capacity
    • a great example
  • index out of range errors
  • appending items to slices
  • deleting items from slices
Slice Examples
09:38

More Slice Examples

  • multidimensional slice
  • incrementing a slice
More Slice Examples
06:33

  • shorthand
  • var
    • sets slice to zero value which is nil
  • make
Creating A Slice
12:43

  • incrementing a slice value
  • review of slices
    • len, cap, underlying array, append
Incrementing A Slice Item
05:16

  • definition
    • a list of values of a certain Type
  • internals
    • reference type
    • pointer, len, cap
    • built on-top of an array
      • another way to say it: “points to an array”
    • The value of an uninitialized slice is nil.
      • because it is a reference type
      • A slice, once initialized, is always associated with an underlying array that holds its elements.
      • slices are dynamic (unlike arrays)
        • their length may change during execution.
    • The array underlying a slice may extend past the end of the slice.
      • Capacity is a measure of that extent:
      • The capacity of a slice a can be discovered using the built-in function cap(a).
  • make
    • A slice created with make always allocates a new, hidden array to which the returned slice value refers.
      • make([]T, length, capacity)
      • make([]int, 50, 100)
        • same as this: new([100]int)[0:50]
    • Like arrays, slices are always one-dimensional but may be composed to construct higher-dimensional objects. (multi-dimensional slices)
  • index out of range errors
  • appending items to slices
    • access by index if the index is less than the length of the slice less one
      • 0 through len(s)-1.
  • deleting items from slices

mySlice = append(mySlice[:2], mySlice[3:]...)

  • incrementing a slice

mySlice[0]++

  • creating a slice
  • shorthand

student := []string{}

  • var
    • sets slice to zero value which is nil

var student []string

  • make

student := make([]string, 35)

Section Review
12:29
+
Data Structures - Map
12 Lectures 01:45:04
  • maps
    • key / value storage
    • a “dictionary”
    • an unordered group of elements of one type, called the element type
      • indexed by a set of unique keys of another type, called the key type.
      • The value of an uninitialized map is nil.
  • reference type
Maps Introduction
06:18

  • creating maps
    • var
    • make
    • shorthand
  • adding entries
Map Examples - Part I
08:30

updating entries

Map Examples - Part II
08:46

deleting entries

Map Examples - Part III
05:08

  • documentation
    • golang spec
    • effective go
    • github golang
  • comma, ok idiom
Map Documentation
10:43

Map Range Loop
Map Range Loop
03:43

Doing a pull in GitHub; keeping two computers synced with the same repo.

GitHub Pull
04:08

  • Macro View of Map Internals In Go
  • hash tables explained
Hash Tables
13:52

Hash Tables
Hashing Words
10:57

hashing words

Hashing Words II
12:05

  • building a hash table
    • letter buckets
    • remainder buckets
    • hashing words
Build A Hash Table
09:13

  • http.Get
  • bufio.NewScanner
  • scanner.Split
  • bufio.ScanWords
  • multi-dimensional slice
    • slice of slice of string
  • defer
  • ++
Finished Hash Algorithm
11:41
9 More Sections
About the Instructor
Todd McLeod
4.5 Average rating
10,202 Reviews
126,384 Students
11 Courses
Faculty in Computer Science and Computer Information Tech

I am passionate about helping others learn and improve their lives. The courses offered under my account are courses taught by myself, along with courses I helped friends create. As for my credentials, I am tenured faculty in Computer Information Technology at Fresno City College. I have also served as adjunct faculty in Computer Science at California State University, Fresno. I began programming in 1996. I began teaching programming in 2001. My area of expertise is web programming, the Go programming language, and online education. I have taught over 560,000 students online how to build websites and use the Go programming language. Follow me on Twitter to stay current @Todd_McLeod