Débutant
Go
Apprenez Go de bout en bout. Commencez par les packages, les variables et le flux de controle, puis approfondissez les structs, les interfaces, la concurrence, les tests, les serveurs HTTP, les bases de donnees, les generiques, le profilage et la mise en production de vrais binaires.
20 leçons12.3h pratique11 langues
Commencez à apprendre gratuitementGo cours20 leçons, dans l’ordre
- 125 min
Bonjour, Go
Package mainImportFunc mainFmt.PrintlnGo run - 225 min
Variables et types
Var declarationShort declaration :=IntFloat64StringBool+2 - 330 min
Structures de contrôle : if et for
IfElse ifElseFor loopFor as whileInfinite for+2 - 430 min
Fonctions
Func keywordParametersReturn valuesMultiple return valuesNamed return valuesBlank identifier - 535 min
Slices et maps
Slice literalAppendLenIndexingRangeMap literal+2 - 640 min
Petit projet final en ligne de commande
Os.ArgsStrconv.AtoiError handling with if err != nilOs.ExitGo buildPutting it together - 735 min
Structures et pointeurs
Struct definitionField accessZero values for structsPointer types& and * operatorsPointer receivers vs value receivers+1 - 835 min
Méthodes et interfaces
Method declarationReceiver typesPointer vs value receiversInterface definitionImplicit interface satisfactionSmall interfaces+1 - 935 min
Gestion des erreurs
Error interfaceFmt.Errorf with %wErrors.IsErrors.AsCustom error typesPanic vs error+1 - 1040 min
Goroutines et canaux
The go keywordGoroutine lifetimeUnbuffered channelsBuffered channelsSend and receiveRange over channel+1 - 1145 min
Modèles de concurrence
Select statementContext.Context for cancellationSync.WaitGroupSync.MutexWorker pool patternFan-out fan-in idea - 1240 min
Une visite de la bibliothèque standard
FmtStringsStrconvTimeOsBufio+1 - 1340 min
Tests et benchmarks
Go testTesting.TTable-driven testsT.Run subtestsTesting.B benchmarks_test.go file naming+1 - 1435 min
Modules et structure de projet
Go mod initGo.mod and go.sumImport pathsPackage vs moduleInternal/ folderCmd/ layout+1 - 1545 min
Serveurs HTTP
Net/httpHttp.HandleFuncHttp.ServerJSON responsesRequest routingMiddleware via http.Handler wrapping+1 - 1645 min
Bases de données avec database/sql
Database/sql packageDriver importsSql.Open and sql.DB poolExec vs Query vs QueryRowPrepared statementsScanning rows+1 - 1735 min
Génériques
Type parameters with [T any]ConstraintsComparableTilde approximation ~intGeneric Map and FilterWhen generics help, when they do not - 1840 min
Performance et profilage
Go test -benchPprof CPU and heap profilesEscape analysis with -gcflags=-mAvoiding unnecessary allocationsPreallocating slicesSync.Pool intuition - 1940 min
Patrons de conception en Go
Functional options patternRepository patternDependency injection via interfacesContext propagation through call stacksConstructor functions - 2045 min
Déploiement et production
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
Apprenez Go dans votre langue
Chaque leçon, quiz et réponse du tuteur s’affiche dans votre langue. Le tuteur IA répond dans la langue que vous utilisez.
