Learning Go [Book] - O'Reilly Media
文章推薦指數: 80 %
No matter your level of experience, you'll learn how to think like a Go developer. Author Jon Bodner introduces the design patterns experienced Go developers ... Skiptomaincontent GetfullaccesstoLearningGoand60K+othertitles,withfree10-daytrialofO'Reilly. There'salsoliveonlineevents,interactivecontent,certificationprepmaterials,andmore. Startyourfreetrial LearningGo byJonBodner ReleasedMarch2021 Publisher(s):O'ReillyMedia,Inc. ISBN:9781492077213 ExploreapreviewversionofLearningGorightnow. O’Reillymembersgetunlimitedaccesstoliveonlinetrainingexperiences,plusbooks,videos,anddigitalcontentfrom200+publishers. BuyonAmazon Startyourfreetrial Bookdescription Goisrapidlybecomingthepreferredlanguageforbuildingwebservices.WhilethereareplentyoftutorialsavailablethatteachGo'ssyntaxtodeveloperswithexperienceinotherprogramminglanguages,tutorialsaren'tenough.Theydon'tteachGo'sidioms,sodevelopersenduprecreatingpatternsthatdon'tmakesenseinaGocontext.ThispracticalguideprovidestheessentialbackgroundyouneedtowriteclearandidiomaticGo.Nomatteryourlevelofexperience,you'lllearnhowtothinklikeaGodeveloper.AuthorJonBodnerintroducesthedesignpatternsexperiencedGodevelopershaveadoptedandexplorestherationaleforusingthem.You'llalsogetapreviewofGo'supcominggenericssupportandhowitfitsintothelanguage.LearnhowtowriteidiomaticcodeinGoanddesignaGoprojectUnderstandthereasonsforthedesigndecisionsinGoSetupaGodevelopmentenvironmentforasolodeveloperorteamLearnhowandwhentousereflection,unsafe,andcgoDiscoverhowGo'sfeaturesallowthelanguagetorunefficientlyKnowwhichGofeaturesyoushouldusesparinglyornotatall Showandhidemore Publisherresources View/SubmitErrata DownloadExampleCode TableofcontentsProductinformation Tableofcontents Preface WhoShouldReadThisBook ConventionsUsedinThisBook UsingCodeExamples O’ReillyOnlineLearning HowtoContactUs Acknowledgments 1.SettingUpYourGoEnvironment InstallingtheGoTools TheGoWorkspace ThegoCommand gorunandgobuild GettingThird-PartyGoTools FormattingYourCode LintingandVetting ChooseYourTools VisualStudioCode GoLand TheGoPlayground Makefiles StayingUptoDate WrappingUp 2.PrimitiveTypesandDeclarations Built-inTypes TheZeroValue Literals Booleans NumericTypes ATasteofStringsandRunes ExplicitTypeConversion varVersus:= Usingconst TypedandUntypedConstants UnusedVariables NamingVariablesandConstants WrappingUp 3.CompositeTypes Arrays—TooRigidtoUseDirectly Slices len append Capacity make DeclaringYourSlice SlicingSlices ConvertingArraystoSlices copy StringsandRunesandBytes Maps ReadingandWritingaMap ThecommaokIdiom DeletingfromMaps UsingMapsasSets Structs AnonymousStructs ComparingandConvertingStructs WrappingUp 4.Blocks,Shadows,andControlStructures Blocks ShadowingVariables DetectingShadowedVariables if for,FourWays TheCompleteforStatement TheCondition-OnlyforStatement TheInfiniteforStatement breakandcontinue Thefor-rangeStatement LabelingYourforStatements ChoosingtheRightforStatement switch BlankSwitches ChoosingBetweenifandswitch goto—Yes,goto WrappingUp 5.Functions DeclaringandCallingFunctions SimulatingNamedandOptionalParameters VariadicInputParametersandSlices MultipleReturnValues MultipleReturnValuesAreMultipleValues IgnoringReturnedValues NamedReturnValues BlankReturns—NeverUseThese! FunctionsAreValues FunctionTypeDeclarations AnonymousFunctions Closures PassingFunctionsasParameters ReturningFunctionsfromFunctions defer GoIsCallByValue WrappingUp 6.Pointers AQuickPointerPrimer Don’tFearthePointers PointersIndicateMutableParameters PointersAreaLastResort PointerPassingPerformance TheZeroValueVersusNoValue TheDifferenceBetweenMapsandSlices SlicesasBuffers ReducingtheGarbageCollector’sWorkload WrappingUp 7.Types,Methods,andInterfaces TypesinGo Methods PointerReceiversandValueReceivers CodeYourMethodsfornilInstances MethodsAreFunctionsToo FunctionsVersusMethods TypeDeclarationsAren’tInheritance TypesAreExecutableDocumentation iotaIsforEnumerations—Sometimes UseEmbeddingforComposition EmbeddingIsNotInheritance AQuickLessononInterfaces InterfacesAreType-SafeDuckTyping EmbeddingandInterfaces AcceptInterfaces,ReturnStructs Interfacesandnil TheEmptyInterfaceSaysNothing TypeAssertionsandTypeSwitches UseTypeAssertionsandTypeSwitchesSparingly FunctionTypesAreaBridgetoInterfaces ImplicitInterfacesMakeDependencyInjectionEasier Wire GoIsn’tParticularlyObject-Oriented(andThat’sGreat) WrappingUp 8.Errors HowtoHandleErrors:TheBasics UseStringsforSimpleErrors SentinelErrors ErrorsAreValues WrappingErrors IsandAs WrappingErrorswithdefer panicandrecover GettingaStackTracefromanError WrappingUp 9.Modules,Packages,andImports Repositories,Modules,andPackages go.mod BuildingPackages ImportsandExports CreatingandAccessingaPackage NamingPackages HowtoOrganizeYourModule OverridingaPackage’sName PackageCommentsandgodoc TheinternalPackage TheinitFunction:AvoidifPossible CircularDependencies GracefullyRenamingandReorganizingYourAPI WorkingwithModules ImportingThird-PartyCode WorkingwithVersions MinimumVersionSelection UpdatingtoCompatibleVersions UpdatingtoIncompatibleVersions Vendoring pkg.go.dev AdditionalInformation PublishingYourModule VersioningYourModule ModuleProxyServers SpecifyingaProxyServer PrivateRepositories WrappingUp 10.ConcurrencyinGo WhentoUseConcurrency Goroutines Channels Reading,Writing,andBuffering for-rangeandChannels ClosingaChannel HowChannelsBehave select ConcurrencyPracticesandPatterns KeepYourAPIsConcurrency-Free Goroutines,forLoops,andVaryingVariables AlwaysCleanUpYourGoroutines TheDoneChannelPattern UsingaCancelFunctiontoTerminateaGoroutine WhentoUseBufferedandUnbufferedChannels Backpressure TurningOffacaseinaselect HowtoTimeOutCode UsingWaitGroups RunningCodeExactlyOnce PuttingOurConcurrentToolsTogether WhentoUseMutexesInsteadofChannels Atomics—YouProbablyDon’tNeedThese WheretoLearnMoreAboutConcurrency WrappingUp 11.TheStandardLibrary ioandFriends time MonotonicTime TimersandTimeouts encoding/json UseStructTagstoAddMetadata UnmarshalingandMarshaling JSON,Readers,andWriters EncodingandDecodingJSONStreams CustomJSONParsing net/http TheClient TheServer WrappingUp 12.TheContext WhatIstheContext? Cancellation Timers HandlingContextCancellationinYourOwnCode Values WrappingUp 13.WritingTests TheBasicsofTesting ReportingTestFailures SettingUpandTearingDown StoringSampleTestData CachingTestResults TestingYourPublicAPI Usego-cmptoCompareTestResults TableTests CheckingYourCodeCoverage Benchmarks StubsinGo httptest IntegrationTestsandBuildTags FindingConcurrencyProblemswiththeRaceChecker WrappingUp 14.HereThereBeDragons:Reflect, Unsafe,andCgo ReflectionLetsUsWorkwithTypesatRuntime Types,Kinds,andValues MakingNewValues UseReflectiontoCheckIfanInterface’sValueIsnil UseReflectiontoWriteaDataMarshaler BuildFunctionswithReflectiontoAutomateRepetitiveTasks YouCanBuildStructswithReflection,butDon’t ReflectionCan’tMakeMethods OnlyUseReflectionIfIt’sWorthwhile unsafeIsUnsafe UseunsafetoConvertExternalBinaryData unsafeStringsandSlices unsafeTools CgoIsforIntegration,NotPerformance WrappingUp 15.ALookattheFuture:GenericsinGo GenericsReduceRepetitiveCodeandIncreaseTypeSafety IntroducingGenericsinGo UseTypeListstoSpecifyOperators GenericFunctionsAbstractAlgorithms TypeListsLimitConstantsandImplementations ThingsThatAreLeftOut IdiomaticGoandGenerics FurtherFuturesUnlocked WrappingUp Index Showandhidemore Productinformation Title:LearningGo Author(s):JonBodner Releasedate:March2021 Publisher(s):O'ReillyMedia,Inc. ISBN:9781492077213 Youmightalsolike book 40AlgorithmsEveryProgrammerShouldKnow by ImranAhmad Learnalgorithmsforsolvingclassiccomputerscienceproblemswiththisconciseguidecoveringeverythingfromfundamental… book DesigningData-IntensiveApplications by MartinKleppmann Dataisatthecenterofmanychallengesinsystemdesigntoday.Difficultissuesneedto… video CleanCode by RobertC.Martin ExpandedEdition(August2018)UpdatedwithDesignPatternsepisodesfromtheCleanCodeseriesfromClean… book SoftwareEngineeringatGoogle by TitusWinters, TomManshreck, HyrumWright Today,softwareengineersneedtoknownotonlyhowtoprogrameffectivelybutalsohowto… Don’tleaveempty-handed GetMarkRichards’sSoftwareArchitecturePatternsebooktobetterunderstandhowtodesigncomponents—andhowtheyshouldinteract. It’syours,free. Getitnow Close
延伸文章資訊
- 1Golang
Build fast, reliable, and efficient software at scale · Go is an open source programming language...
- 2Learning Go [Book] - O'Reilly Media
No matter your level of experience, you'll learn how to think like a Go developer. Author Jon Bod...
- 3Get Started - go.dev
Learning Resources · Guided learning journeys · Online learning · Google Cloud Self-Paced Labs · ...
- 4An Idiomatic Approach to Real-World Go Programming - 博客來
書名:Learning Go: An Idiomatic Approach to Real-World Go Programming,語言:英文,ISBN:9781492077213,頁數:30...
- 5Learning Go: An Idiomatic Approach to Real-World Go ...
Learning Go starts by looking at how to set up a Go development environment, and then covers vari...