欢迎来到天天文库
浏览记录
ID:33866479
大小:803.30 KB
页数:115页
时间:2019-03-01
《A Quick Introduction to System Tools Programming with Go Presentation.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、QuickIntroductiontoSystemToolsProgrammingwithGo!ChrisMcEnirySonyNetworkEntertainment@macmceniryhttp://blog.corgalabs.com/AdministiviaGoals!GainanoviceunderstandingoftheGoProgrammingLanguage!KnowhowtoapplythatunderstandingtocommonworkneedsthatSysadminsseeSomethingstoknowbeforewegetstarted
2、!Go-Why?-Opinionated-Howtogetstarted!TheTutorial-Conventions-ExamplesWhyGo?!Simpleenoughlanguagetokeepitinyourhead!Built-inConcurrencyPrimitives!FastCompilation!SimplifiedDeployments!Flexibilityofadynamiclanguage.Safetyofastatic!Builtingarbagecollection-avoidmemorygamesOpnionated!There’s
3、awaytodowhitespace:gofmt!Veryfewcontrolstructures(8statementterminatingkeywords)!Justoneloop:for!Nosemicolons!Noextraparenthesisinconditionals!Allerrors,notwarnings!Mustusewhatyoudeclare!Everythingisinitialized!“Ordernotspecified”reallydoesmeanyoucan’trelyonthereturnorderGettingStarted!D
4、ownloadgo!SetEnvironmentVariables-GOROOT:LocationoftheGotools-GOPATH:LocationoftheWorkspace!Workspace:Workingdirectoryforaproject-bin,pkg,src-WorkspaceisnotwhatgoesunderversioncontrolInvocations!gorun:Executeagofile!gobuild:Buildastandaloneobjectfileorexecutable!goinstall:Installfromthes
5、ourcetreeapackageorbinary!godoc:Printoutembeddeddocumentationforapackage!godoc:Extractsandgeneratesdocuementationforapackage(andcanhostawebserverforit)!gofmt:Appliesstandardformattingtoapackage!gofmt:Appliesstandardformattingtostdin!goget:Downloadmodulesrcfromanupstreamrepository!gohelp:
6、CommandlinehelpConventionsusedinthispresentation!Informationaltext-Arial!Code-Chalkboardvar(!foo=1!bar=2)!!Shell-Courierecho“helloFOO”
7、!sed-e’s/FOO/world;Kata!Usingarealexampletoconveytheconcepts!Brokenintomultiplesections-Eachfocusingonaparticularmethod!Fourwaystofollowalong:-Readalong
8、ontheslides-Readthegithubcodehttps://github.com/cmceniry/gotutorial-RuntheVMbeingpassedaroundonUSBstick.Login:golang/golang-vagrantupfromthemaincoderepository!Keepituptodatewiththetutorial:goget-ugithub.com/cmceniry/gotutorial!!Examplenamewillbenotedinthebottomrightcorner
此文档下载收益归作者所有