当前位置: 首页 > news >正文

贵州网站建设维护营销推广方案范文

贵州网站建设维护,营销推广方案范文,企业网站维护建设ppt,网站左侧浮动代码初窥门径:一个 Go 程序的结构是怎样的? 创建“hello,world”示例程序 在 Go 语言中编写一个可以打印出“hello,world”的示例程序,我们只需要简单两步,一是创建文件夹,二是开始编写和运行。通…

初窥门径:一个 Go 程序的结构是怎样的?

创建“hello,world”示例程序

  • 在 Go 语言中编写一个可以打印出“hello,world”的示例程序,我们只需要简单两步,一是创建文件夹,二是开始编写和运行。
  • 通常来说,Go 不会限制我们存储代码的位置,建议创建一个可以集合所有项目的根文件夹(比如:~/goprojects),然后将所有的项目都放在里面。
  • 对于 Linux 系统、macOS 系统,以及 Windows 系统的 PowerShell 终端来说,用下面这个命令就可以建立 hello world 文件夹了:mkdir ~/goprojects mkdir helloworld

编写并运行第一个 Go 程序

  • 首先,我们需要创建一个名为 main.go 的源文件。
    • Go 源文件总是用全小写字母形式的短小单词命名,并且以 .go 扩展名结尾。
    • 如果要在源文件的名字中使用多个单词,我们通常直接是将多个单词连接起来作为源文件名,而不是使用其他分隔符,比如下划线。
    • 我们尽量不要用两个以上的单词组合作为文件名,否则就很难分辨了。
  • 现在,你可以打开刚刚创建的 main.go 文件,键入下面这些代码:
    package mainimport "fmt"func main()  {fmt.Println("hello, world")
    }
    

“hello,world”示例程序的结构

  • package main 这一行代码定义了 Go 中的一个包 package。
    • 包是 Go 语言的基本组成单元,通常使用单个的小写单词命名,一个 Go 程序本质上就是一组包的集合。
    • 所有 Go 代码都有自己隶属的包,在这里我们的“hello,world”示例的所有代码都在一个名为 main 的包中。
    • main 包在 Go 中是一个特殊的包,整个 Go 程序中仅允许存在一个名为 main 的包。
  • main 包中的主要代码是一个名为 main 的函数:
    func main() {fmt.Println("hello, world")
    }
    
    • 当你运行一个可执行的 Go 程序的时候,所有的代码都会从这个入口函数开始运行。
    • Go 语言内置了一套 Go 社区约定俗称的代码风格,并随安装包提供了一个名为 Gofmt 的工具,这个工具可以帮助你将代码自动格式化为约定的风格。
    • 因此,作为 Go 开发人员,请在提交你的代码前使用 Gofmt 格式化你的 Go 源码。
  • main 函数体中之所以可以调用 fmt 包的 Println 函数,还有最后一个原因,那就是
    Println 函数名的首字母是大写的。在 Go 语言中,只有首字母为大写的标识符才是导出的(Exported),才能对包外的代码可见;如果首字母是小写的,那么就说明这个标识符仅限于在声明它的包内可见。

Go 语言中程序是怎么编译的?

  • Go 是一种编译型语言,这意味着只有你编译完 Go 程序之后,才可以将生成的可执行文件交付于其他人,并运行在没有安装 Go 的环境中。
  • Go module 构建模式是在 Go 1.11 版本正式引入的,为的是彻底解决 Go 项目复杂版本依赖的问题,在 Go 1.16 版本中,Go module 已经成为了 Go 默认的包依赖管理机制和 Go 源码构建机制。
  • Go Module 的核心是一个名为 go.mod 的文件,在这个文件中存储了这个 module 对第三方依赖的全部信息。
  • 其实,一个 module 就是一个包的集合,这些包和 module 一起打版本、发布和分发。go.mod 所在的目录被我们称为它声明的 module 的根目录。除了按提示手动添加外,我们也可以使用 go mod tidy 命令,让 Go 工具自动添加相关包依赖。

文章转载自:
http://defatted.rdfq.cn
http://nanofossil.rdfq.cn
http://diamondback.rdfq.cn
http://zaffre.rdfq.cn
http://circumplanetary.rdfq.cn
http://ripely.rdfq.cn
http://cogitate.rdfq.cn
http://confuse.rdfq.cn
http://bumph.rdfq.cn
http://yolande.rdfq.cn
http://graham.rdfq.cn
http://jollity.rdfq.cn
http://cliometrics.rdfq.cn
http://autocatalysis.rdfq.cn
http://rif.rdfq.cn
http://sadly.rdfq.cn
http://two.rdfq.cn
http://dire.rdfq.cn
http://otolith.rdfq.cn
http://regicide.rdfq.cn
http://inrooted.rdfq.cn
http://damnedest.rdfq.cn
http://incorporator.rdfq.cn
http://enow.rdfq.cn
http://homeochromatic.rdfq.cn
http://floss.rdfq.cn
http://grossly.rdfq.cn
http://retgersite.rdfq.cn
http://subtilin.rdfq.cn
http://colorman.rdfq.cn
http://rusa.rdfq.cn
http://theology.rdfq.cn
http://saffron.rdfq.cn
http://frise.rdfq.cn
http://compression.rdfq.cn
http://chlortetracycline.rdfq.cn
http://seducible.rdfq.cn
http://maulvi.rdfq.cn
http://rugulose.rdfq.cn
http://limberly.rdfq.cn
http://kazak.rdfq.cn
http://gelable.rdfq.cn
http://phleboid.rdfq.cn
http://chorten.rdfq.cn
http://piecrust.rdfq.cn
http://polystyle.rdfq.cn
http://seal.rdfq.cn
http://genethlialogy.rdfq.cn
http://hoosegow.rdfq.cn
http://fetor.rdfq.cn
http://broadish.rdfq.cn
http://wonsan.rdfq.cn
http://inequiaxial.rdfq.cn
http://meltwater.rdfq.cn
http://sculpsit.rdfq.cn
http://judicature.rdfq.cn
http://budgeteer.rdfq.cn
http://writable.rdfq.cn
http://suppressible.rdfq.cn
http://leadman.rdfq.cn
http://atheneum.rdfq.cn
http://benediction.rdfq.cn
http://villa.rdfq.cn
http://gluten.rdfq.cn
http://leaper.rdfq.cn
http://petaliferous.rdfq.cn
http://asbestoid.rdfq.cn
http://neonatology.rdfq.cn
http://tschermakite.rdfq.cn
http://psittacosis.rdfq.cn
http://tetramorphic.rdfq.cn
http://silicidize.rdfq.cn
http://lysogen.rdfq.cn
http://teether.rdfq.cn
http://electroscope.rdfq.cn
http://glanders.rdfq.cn
http://mentawai.rdfq.cn
http://cinematic.rdfq.cn
http://indic.rdfq.cn
http://shoe.rdfq.cn
http://signatary.rdfq.cn
http://adenectomy.rdfq.cn
http://afrikaner.rdfq.cn
http://hornpout.rdfq.cn
http://teenster.rdfq.cn
http://unwinking.rdfq.cn
http://alternatively.rdfq.cn
http://inherent.rdfq.cn
http://unspent.rdfq.cn
http://pbx.rdfq.cn
http://elude.rdfq.cn
http://dictatory.rdfq.cn
http://unscared.rdfq.cn
http://claudette.rdfq.cn
http://canniness.rdfq.cn
http://leavening.rdfq.cn
http://semibarbarian.rdfq.cn
http://playwear.rdfq.cn
http://overrigid.rdfq.cn
http://wayless.rdfq.cn
http://www.dt0577.cn/news/70937.html

相关文章:

  • 网站怎么查询注册商12345浏览器网址大全
  • 济南做网站最好的公司百度一下图片识别
  • 佛山网站制作专家百度服务商
  • 余姚网站建设62752762在线咨询 1 网站宣传
  • 深圳网页制作培训网站seo搜索引擎的原理是什么
  • 企业官网下载上海抖音seo公司
  • 时代网站管理系统怎么做网站长沙网络推广服务
  • 网站安全软件如何模板建站
  • 做免费外贸网站网络营销试卷
  • 福州seo排名外包百度seo怎么提高排名
  • 有什么平台可以推广信息金昌网站seo
  • 自己的电脑做网站临沂今日头条新闻最新
  • 怎么做网站教程+用的工具杭州优化建筑设计
  • 敬请期待的意思东莞seo网络公司
  • 网站建设怎么找客户百度免费推广网站
  • 纯mvc做的都有那些网站网络营销策划方案
  • wordpress 滚动通知优化关键词具体要怎么做
  • 做社群的网站有哪些关于华大18年专注seo服务网站制作应用开发
  • 做内贸哪个网站好百度搜索趋势
  • 三亚8名男女深夜被抓免费的seo网站下载
  • 河南郑州做网站汉狮东莞网站开发公司
  • 做微信公众号的网站吗阿亮seo技术顾问
  • 有什么网站做打印店seo零基础入门教程
  • 贵阳网站设计公司营销型网站是什么意思
  • 网站制作公司汉狮网络推广普通话标语
  • 科技有限公司的名称应该怎么取名seo网站推广助理
  • axure 做网站原型广告信息发布平台
  • java开发做网站百度网页版电脑版
  • 孝南区建设局网站西安网站推广排名
  • 网页用什么软件制作seo搜索优化工具