入门
Go
全面学习 Go 语言。从包、变量和控制流入手,深入探索结构体、接口、并发、测试、HTTP 服务器、数据库、泛型、性能分析,以及将真实二进制文件发布到生产环境。
20 节12.3h 实操11 种语言
免费开始学习Go 课程共 20 节,按顺序
- 125 分钟
你好,Go
Package mainImportFunc mainFmt.PrintlnGo run - 225 分钟
变量与类型
Var declarationShort declaration :=IntFloat64StringBool+2 - 330 分钟
控制流:if 与 for
IfElse ifElseFor loopFor as whileInfinite for+2 - 430 分钟
函数
Func keywordParametersReturn valuesMultiple return valuesNamed return valuesBlank identifier - 535 分钟
切片与映射
Slice literalAppendLenIndexingRangeMap literal+2 - 640 分钟
迷你 CLI 综合项目
Os.ArgsStrconv.AtoiError handling with if err != nilOs.ExitGo buildPutting it together - 735 分钟
结构体与指针
Struct definitionField accessZero values for structsPointer types& and * operatorsPointer receivers vs value receivers+1 - 835 分钟
方法与接口
Method declarationReceiver typesPointer vs value receiversInterface definitionImplicit interface satisfactionSmall interfaces+1 - 935 分钟
错误处理
Error interfaceFmt.Errorf with %wErrors.IsErrors.AsCustom error typesPanic vs error+1 - 1040 分钟
协程与通道
The go keywordGoroutine lifetimeUnbuffered channelsBuffered channelsSend and receiveRange over channel+1 - 1145 分钟
并发模式
Select statementContext.Context for cancellationSync.WaitGroupSync.MutexWorker pool patternFan-out fan-in idea - 1240 分钟
标准库之旅
FmtStringsStrconvTimeOsBufio+1 - 1340 分钟
测试与基准测试
Go testTesting.TTable-driven testsT.Run subtestsTesting.B benchmarks_test.go file naming+1 - 1435 分钟
模块与项目结构
Go mod initGo.mod and go.sumImport pathsPackage vs moduleInternal/ folderCmd/ layout+1 - 1545 分钟
HTTP 服务器
Net/httpHttp.HandleFuncHttp.ServerJSON responsesRequest routingMiddleware via http.Handler wrapping+1 - 1645 分钟
使用 database/sql 的数据库
Database/sql packageDriver importsSql.Open and sql.DB poolExec vs Query vs QueryRowPrepared statementsScanning rows+1 - 1735 分钟
泛型
Type parameters with [T any]ConstraintsComparableTilde approximation ~intGeneric Map and FilterWhen generics help, when they do not - 1840 分钟
性能与分析
Go test -benchPprof CPU and heap profilesEscape analysis with -gcflags=-mAvoiding unnecessary allocationsPreallocating slicesSync.Pool intuition - 1940 分钟
Go 语言中的设计模式
Functional options patternRepository patternDependency injection via interfacesContext propagation through call stacksConstructor functions - 2045 分钟
部署与生产
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
用你的语言学习 Go
每一节课、测验和导师回复都以你的语言显示。AI 导师会用你提问的语言来回答。
