EasyEnv
Go
Beginner

Go

Learn Go end to end. Start with packages, variables, and control flow, then go deeper into structs, interfaces, concurrency, testing, HTTP servers, databases, generics, profiling, and shipping real binaries to production.

20 lessons12.3h hands-on11 languages
Start learning freeGo course

20 lessons, in order

  1. 1

    Hello, Go

    Welcome. If you have never written code before, you are in the right place. Go is a programming language, which is a way to give a computer step by...

    Package mainImportFunc mainFmt.PrintlnGo run
    25 min
  2. 2

    Variables and Types

    In the last lesson you printed a fixed piece of text. Real programs need to remember things that change: a customer's name, a price, whether a...

    Var declarationShort declaration :=IntFloat64StringBool+2
    25 min
  3. 3

    Control Flow: if and for

    So far every program you have written runs top to bottom, one line after another, with no choices along the way. Real programs need to react: charge...

    IfElse ifElseFor loopFor as whileInfinite for+2
    30 min
  4. 4

    Functions

    Every program you have written so far has lived inside func main(). That works for a dozen lines, but real programs need to compute the same thing in...

    Func keywordParametersReturn valuesMultiple return valuesNamed return valuesBlank identifier
    30 min
  5. 5

    Slices and Maps

    Every variable you have used so far holds exactly one value: one name, one age, one price. Most real problems involve a group of things: a roster of...

    Slice literalAppendLenIndexingRangeMap literal+2
    35 min
  6. 6

    Structs and Pointers

    Every variable you have written so far in this course holds one loose value: a single number, a single string, a single slice. Real data rarely comes...

    Struct definitionField accessZero values for structsPointer types& and * operatorsPointer receivers vs value receivers+1
    35 min
  7. 7

    Methods and Interfaces

    The last lesson taught you how to bundle related fields into a struct, but a struct on its own only holds data, it has no behavior. If you want a...

    Method declarationReceiver typesPointer vs value receiversInterface definitionImplicit interface satisfactionSmall interfaces+1
    35 min
  8. 8

    Error Handling

    You have already typed if err != nil more than once in this course without stopping to ask what err actually is or where it comes from. Functions...

    Error interfaceFmt.Errorf with %wErrors.IsErrors.AsCustom error typesPanic vs error+1
    35 min
  9. 9

    Modules and Project Structure

    Every program you have written in this course so far has lived as a single file you could run with one command. Real Go projects almost never stay...

    Go mod initGo.mod and go.sumImport pathsPackage vs moduleInternal/ folderCmd/ layout+1
    35 min
  10. 10

    Tiny CLI Capstone

    Up to now every program you have written has had its inputs baked into the source. If you wanted to add different numbers, you edited the file and...

    Os.ArgsStrconv.AtoiError handling with if err != nilOs.ExitGo buildPutting it together
    40 min
  11. 11

    A Tour of the Standard Library

    There is a moment in learning any language where you stop wondering how to write a loop and start wondering how to read a file, or format a date, or...

    FmtStringsStrconvTimeOsBufio+1
    40 min
  12. 12

    Testing and Benchmarks

    You wrote a function, ran the program, saw the right answer, and moved on. A week later you change something nearby and the function quietly starts...

    Go testTesting.TTable-driven testsT.Run subtestsTesting.B benchmarks_test.go file naming+1
    40 min
  13. 13

    Goroutines and Channels

    Your program needs to download twenty files. Written the ordinary way, it downloads the first one, waits, downloads the second one, waits, and so on....

    The go keywordGoroutine lifetimeUnbuffered channelsBuffered channelsSend and receiveRange over channel+1
    40 min
  14. 14

    Concurrency Patterns

    Goroutines and channels are raw materials, like wood and screws. Knowing what they are does not tell you how to build a chair. In practice, almost...

    Select statementContext.Context for cancellationSync.WaitGroupSync.MutexWorker pool patternFan-out fan-in idea
    45 min
  15. 15

    Generics

    You write a function that finds the largest number in a slice of int. Then you need one for float64, so you copy it and change two words. Then one...

    Type parameters with [T any]ConstraintsComparableTilde approximation ~intGeneric Map and FilterWhen generics help, when they do not
    35 min
  16. 16

    HTTP Servers

    In most languages, "write a web service" begins with choosing a framework, and the choice matters, because the framework decides how routing works,...

    Net/httpHttp.HandleFuncHttp.ServerJSON responsesRequest routingMiddleware via http.Handler wrapping+1
    45 min
  17. 17

    Databases with database/sql

    Every program you have written so far forgets everything the moment it exits. That is fine for a tool that transforms its input and stops, and...

    Database/sql packageDriver importsSql.Open and sql.DB poolExec vs Query vs QueryRowPrepared statementsScanning rows+1
    45 min
  18. 18

    Performance and Profiling

    At some point someone says the service is slow, and you open the code and immediately spot the loop that must be responsible. You rewrite it, it is...

    Go test -benchPprof CPU and heap profilesEscape analysis with -gcflags=-mAvoiding unnecessary allocationsPreallocating slicesSync.Pool intuition
    40 min
  19. 19

    Design Patterns in Go

    Programs get big. A file that made complete sense at two hundred lines becomes a place where a small change breaks something three files away, and...

    Functional options patternRepository patternDependency injection via interfacesContext propagation through call stacksConstructor functions
    40 min
  20. 20

    Deployment and Production

    There is a gap between a program that runs on your laptop and a program you are willing to leave running while you sleep. Closing it is not glamorous...

    CGO_ENABLED=0 static binariesCross-compile with GOOS and GOARCHGraceful shutdown with http.Server and signal.NotifyContextMinimal Dockerfile with scratch or distrolessReading config from environment variables
    45 min
Go Course: Hands-on, in 11 Languages | Engineering Courses