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

嵌入式软件开发前景怎么样保定网站优化

嵌入式软件开发前景怎么样,保定网站优化,网站后台建设招聘,网站原创内容注意事项 所谓的远程仓库指的是github#xff0c;个人首次使用go mod在其他云仓库上尝试#xff0c;并未成功#xff0c;这浪费了我近2小时的时间#xff1b; 如果你是初次尝试#xff0c;那么除了github的地址换一下之外#xff0c;其他的都按照示例操作#xff0c;比如… 注意事项 所谓的远程仓库指的是github个人首次使用go mod在其他云仓库上尝试并未成功这浪费了我近2小时的时间 如果你是初次尝试那么除了github的地址换一下之外其他的都按照示例操作比如目录的创建这也是我把我的操作步骤一个不拉地贴出来的原因你只须按着做必定成功 如果你没有引用github上的go模块也不打算分享代码到github那么go mod对你没有任何作用使用GOPATH即可。   在github上创建一个仓库 https://github.com/2haodb/gomng.git 把项目复制到本地并提交一份代码上去 cd git clone https://github.com/2haodb/gomng.git cd gomng/ git remote add mng https://github.com/2haodb/gomng.git cp -r /opt/dev/test/src/mod_test/ . git add . git commit -m 1.0.1 git push -u mng master   代码内容 别人向你提到使用GO展示一个东西时一定要用到GO的一些特性尤其是面试官让你用GO写一段代码的时侯 rootblack:~/gomng/mod_test/main# cd .. rootblack:~/gomng/mod_test# ls main pkg1 rootblack:~/gomng/mod_test# cd pkg1/ rootblack:~/gomng/mod_test/pkg1# cat test.go package pkg1 import(fmttime )func Test(){c : make(chan struct{})go func(){fmt.Println(我要出去看看园子里的花还活着吗)time.Sleep(7*time.Second)c - struct{}{}}()- cfmt.Println(这花被别人拿走了再也看不到它了) }   rootblack:~/gomng/mod_test/main# cat main.go package main import(github.com/2haodb/gomng/mod_test/pkg1 )func main(){pkg1.Test() }   执行go mod # echo $GOPATH/opt/code/gopath:/opt/dev/test export GO111MODULEon cd ~/gomng/mod_test/pkg1/ rm -rf go.mod go mod init github.com/2haodb/gomng/mod_test/pkg1 rootblack:~/gomng/mod_test/main# go mod init github.com/2haodb/gomng/mod_test/main go: creating new go.mod: module github.com/2haodb/gomng/mod_test/main rootblack:~/gomng/mod_test/main# ll total 16 drwxr-xr-x 2 root root 4096 9月 12 18:03 ./ drwxr-xr-x 4 root root 4096 9月 12 17:24 ../ -rw------- 1 root root 54 9月 12 18:03 go.mod -rw-r--r-- 1 root root 99 9月 12 17:31 main.go rootblack:~/gomng/mod_test/main# cat go.mod module github.com/2haodb/gomng/mod_test/maingo 1.12   重点说明-版本号 在github有类似下面的话就在页面上绿色的按钮点击下载的位置的下面一行其中这个4166d71就是go mod需要的版本号 Latest commit4166d7121 minutes ago   那么对应的require部分可以这么写 module github.com/2haodb/gomng/mod_test/mainrequire github.com/2haodb/gomng/mod_test/pkg1 4166d71 go 1.12   在运行程序之后会自动转化为下面的v版本 rootblack:~/gomng/mod_test/main# cat go.mod module github.com/2haodb/gomng/mod_test/main require github.com/2haodb/gomng/mod_test/pkg1 v0.0.0-20190912093654-4166d71402a6 go 1.12   运行示例 rootblack:~/gomng/mod_test/main# go run main.go go: finding github.com/2haodb/gomng/mod_test/pkg1 4166d71 我要出去看看园子里的花还活着吗 这花被别人拿走了再也看不到它了 rootblack:~/gomng/mod_test/main# go run main.go 我要出去看看园子里的花还活着吗 这花被别人拿走了再也看不到它了 可以看到首次运行的结果与第二次不一样这是因为首次运行时go把依赖的模块下载下来了 mod自动下载代码位置 go mod方式运行代码时自动将依赖的模块下载到$GOPATH/pkg/mod目录下后续运行直接引用mod下的模块同时不会再去$GOPATH/src目录下找了。 rootblack:~# echo $GOPATH /opt/code/gopath:/opt/dev/test rootblack:~# ll /opt/code/gopath/pkg/mod/github.com/2haodb/gomng/mod_test total 12 drwxr-xr-x 3 root root 4096 9月 12 17:41 ./ drwxr-xr-x 3 root root 4096 9月 12 17:41 ../ dr-x------ 2 root root 4096 9月 12 17:41 pkg1v0.0.0-20190912093654-4166d71402a6/   重新演示一下上面的流程-任意位置 rootblack:/tmp# mkdir ccc rootblack:/tmp# cd ccc/ rootblack:/tmp/ccc# vim main.go rootblack:/tmp/ccc# go mod init github.com/2haodb/gomng/mod_test/main go: creating new go.mod: module github.com/2haodb/gomng/mod_test/main rootblack:/tmp/ccc# vim go.mod rootblack:/tmp/ccc# go run main.go go: finding github.com/2haodb/gomng/mod_test/pkg1 4166d71 我要出去看看园子里的花还活着吗 这花被别人拿走了再也看不到它了 main.go与go.mod的内容与之前相同不同的是主程序的位置变了 但这没有关系这正是go mod的意义所在你的项目代码可以在任意位置放置只须正确引用github的代码同时也无须关心依赖包的问题了因为运行程序时, go自动下载依赖包到本地$GOPATH/pkg/mod目录。 关闭go mod export GO111MODULEoff 关闭后GOPATH生效   转载于:https://www.cnblogs.com/perfei/p/11514497.html
http://www.pierceye.com/news/857097/

相关文章:

  • 企业类网站谷歌seo招聘
  • asp.net网站安装顺序idc 公司网站模板
  • 新手学做网站优化2022app分类排行
  • 微信微网站制作公司2008年做的网站
  • 网站建设柒首先金手指1男孩做网站
  • 葫芦岛市建设局网站网页制作与网站发布
  • 企业网站首页布局尺寸营销网站建设哪家便宜
  • 专题网站建设策划郑州市做网站的公
  • wordpress網頁版天津百度网站排名优化
  • 做网站建设销售工资代做电大网站ui作业
  • DMZ做网站wordpress 小工具 创建
  • 宠物网站建设方案外贸网站建设公司服务
  • 玉林网站建设学校门户网站建设的意义
  • 湖南营销型网站建设 在线磐石网络现在出入河南最新规定
  • 阿里云虚拟主机网站国内十大mcn公司
  • c 做网站起什么作用电商建站系统
  • wordpress 网站 上传微信公众平台直接上传wordpress
  • 北滘高明网站建设电子商城网站建设价格
  • 根据一个网站仿做新网站是什么网站代理公司注册收费
  • 创业给企业做网站开发青岛公司建设网站
  • 银川网站建设联系电话郑州网站建设廴汉狮网络
  • 在兔展上怎么做网站页面高端企业网站建站
  • 网站开发 调试网站做seo推广方案
  • 网站的服务器和空间微网站技术
  • 烟台软件优化网站敦煌网站建设
  • wordpress防抓取wordpress seo h1标签
  • 产品宣传网站模板完整个人网站html
  • 多用户商城网站开发seo搜索是什么
  • 永川网站制作网页设计中好的网站
  • 淮南本地网从化网站建设优化