目录

  • 一,序
  • 二,基础学习
  • 三,环境安装
  • 四,项目操练
    • GO111MODULE
  • 五,此外附上我用过的一些资料

一,序

2020年8月3我来实习了,试想一个Java都还没学会熟练使用的人,却要用golang去重新做项目,我能退缩吗,当然不能,于是我用一周的时间来熟悉golang,

二,基础学习

于是我对基础的数据类型,指针,运算符,程序流程控制,函数,包,错误处理,数组,切片,map,结构体,方法,封装继承接口

以及多态,文件操作,以及JSON序列化反序列化,单元测试,进程,线程,反射,管道,socket编程,redis,等有了初步了解,是不是现在就成功了,肿么可能,我要立马上线,去拿项目读源码学习,于是开始了我的配置环境阶段

三,环境安装

我安装的是最新的go版本1.14,下载的是go1.14.windows-amd64.msi 安装文件。文件需要到https://golang.org/ 去下载。由于众所周知的原因,需要翻墙,否则网站打不开。

安装很顺利。安装完后打开一个cmd窗口,输入:

E:\goproject>go version
go version go1.14.6 windows/amd64

说明已经安装成功。

四,项目操练

想着到github上找一个go语言编写的项目弄到本地查看编译下。找到一个bee,beego在如何获取地方看到:

go get github.com/astaxie/beego

这是要在cmd 窗口直接输入这行命令就能获取。我于是试了下。可是,输入命令后看着是在运行,但是运行结束后,报以下提示信息,

原来是代理的问题,

unrecognized import path "golang.org/x/text/transform": https fetch: Get "https://golang.org/x/text/transform?go-get=1":dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because connected host has failed to respond.
unrecognized import path "golang.org/x/text/unicode/norm": https fetch: Get "https://golang.org/x/text/unicode/norm?go-g
et=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly re
spond after a period of time, or established connection failed because connected host has failed to respond.
# cd .; git clone -- https://github.com/gadelkareem/delve C:\Users\luckly\go\src\github.com\gadelkareem\delve
Cloning into 'C:\Users\luckly\go\src\github.com\gadelkareem\delve'...
error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 104
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
package github.com/gadelkareem/delve/pkg/terminal: exit status 128
package github.com/gadelkareem/delve/service: cannot find package "github.com/gadelkareem/delve/service" in any of:F:\sofaware\GO\src\github.com\gadelkareem\delve\service (from $GOROOT)C:\Users\luckly\go\src\github.com\gadelkareem\delve\service (from $GOPATH)
package github.com/gadelkareem/delve/service/debugger: cannot find package "github.com/gadelkareem/delve/service/debugger" in any of:F:\sofaware\GO\src\github.com\gadelkareem\delve\service\debugger (from $GOROOT)C:\Users\luckly\go\src\github.com\gadelkareem\delve\service\debugger (from $GOPATH)
package github.com/gadelkareem/delve/service/rpc2: cannot find package "github.com/gadelkareem/delve/service/rpc2" in any of:F:\sofaware\GO\src\github.com\gadelkareem\delve\service\rpc2 (from $GOROOT)C:\Users\luckly\go\src\github.com\gadelkareem\delve\service\rpc2 (from $GOPATH)
package github.com/gadelkareem/delve/service/rpccommon: cannot find package "github.com/gadelkareem/delve/service/rpccommon" in any of:F:\sofaware\GO\src\github.com\gadelkareem\delve\service\rpccommon (from $GOROOT)C:\Users\luckly\go\src\github.com\gadelkareem\delve\service\rpccommon (from $GOPATH)
# cd C:\Users\luckly\go\src\github.com\astaxie\beego; git pull --ff-only
fatal: not a git repository (or any parent up to mount point /cygdrive)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
package github.com/astaxie/beego/swagger: exit status 128
package github.com/astaxie/beego/utils: cannot find package "github.com/astaxie/beego/utils" in any of:F:\sofaware\GO\src\github.com\astaxie\beego\utils (from $GOROOT)C:\Users\luckly\go\src\github.com\astaxie\beego\utils (from $GOPATH)

于是我发挥了爱学习,爱搜索,爱询问的能力,了解到了有代理这回事,使用go.mod来进行包管理

GO111MODULE

GO111MODULE有三个值:off, onauto(默认值)

  • GO111MODULE=off,go命令行将不会支持module功能,寻找依赖包的方式将会沿用旧版本那种通过vendor目录或者GOPATH模式来查找。

  • GO111MODULE=on,go命令行会使用modules,而一点也不会去GOPATH目录下查找。

  • GO111MODULE=auto
    

    ,默认值,go命令行将会根据当前目录来决定是否启用module功能。这种情况下可以分为两种情形:

    • 当前目录在GOPATH/src之外且该目录包含go.mod文件
    • 当前文件在包含go.mod文件的目录下面。

那么我们就来设置吧,我打开命令行:

C:\Users\luckly>go env -w GO111MODULE=onC:\Users\luckly>go env -w GOPROXY=https://goproxy.io,direct

并进行了简单测试,新建一个名为 main.go的项目,项目路径 e:\goproject (注意,该路径并不在GOPATH里)

当我再次打开命令行的时候

C:\Users\luckly>go get github.com/beego/bee
go: downloading github.com/beego/bee v1.12.0
go: github.com/beego/bee upgrade => v1.12.0
go: downloading github.com/gorilla/websocket v1.4.2
go: downloading github.com/astaxie/beego v1.12.1
go: downloading github.com/lib/pq v1.7.0
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: downloading github.com/gadelkareem/delve v1.4.2-0.20200619175259-dcd0133
go: downloading github.com/smartwalle/pongo2render v1.0.1
go: downloading gopkg.in/yaml.v2 v2.3.0
go: downloading github.com/pelletier/go-toml v1.2.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/flosch/pongo2 v0.0.0-20200529170236-5abacdfa4915
go: downloading golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9
go: downloading github.com/spf13/viper v1.7.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/spf13/pflag v1.0.3
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/spf13/jwalterweatherman v1.0.0
go: downloading gopkg.in/ini.v1 v1.51.0
go: downloading github.com/spf13/cast v1.3.0
go: downloading github.com/magiconair/properties v1.8.1
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading github.com/spf13/afero v1.1.2
go: downloading golang.org/x/text v0.3.2
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/mattn/go-colorable v0.0.9
go: downloading github.com/cosiner/argv v0.1.0
go: downloading github.com/mattn/go-isatty v0.0.3
go: downloading golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4
go: downloading github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b
go: downloading github.com/hashicorp/golang-lru v0.5.4
go: downloading go.starlark.net v0.0.0-20190702223751-32f345186213
go: downloading github.com/konsorten/go-windows-terminal-sequences v1.0.3

竟然成功了,

于是我又紧追其后,在命令行输入了


C:\Users\luckly>bee
Bee is a Fast and Flexible tool for managing your Beego Web Application.USAGEbee command [arguments]AVAILABLE COMMANDSversion     Prints the current Bee versionmigrate     Runs database migrationsapi         Creates a Beego API applicationbale        Transforms non-Go files to Go source filesfix         Fixes your application by making it compatible with newer versions of Beegopro         Source code generatordlv         Start a debugging session using Delvedockerize   Generates a Dockerfile for your Beego applicationgenerate    Source code generatorhprose      Creates an RPC application based on Hprose and Beego frameworksnew         Creates a Beego applicationpack        Compresses a Beego application into a single filers          Run customized scriptsrun         Run the application by starting a local development serverserver      serving static content over HTTP on portUse bee help [command] for more information about a command.ADDITIONAL HELP TOPICSUse bee help [topic] for more information about that topic.

又成功了,至次就成功了吗?没有,为啥?

bee下载到那儿了,不知道,罪过罪过,在我的go语言安装目录的,src ,pkg等下面都没找到,这难道没安上?还是哪里有问题。各种查找。最后终于找到一个解决办法。需要自己创建一个工作区目录。为什么不使用安装目录,是因为要保证安装目录的纯洁性。

打开一看,咋跑C盘去了,仔细一看是自己把代码敲错了,自动添加到C盘了,

我在F盘创建了一个工作目录:F:\software\GO,目录必须是英文,不能有汉字。在这个目录中还要创建3个目录。分别是src,pkg,bin三个目录。并且要在windows系统变量中增加GOPATH,值设置为:F:\software\GO。终于改过来了

然后再打开一个cmd窗口,输入:

go get github.com/beego/bee

执行成功后,可以看到在工作区的src目录下已经有了相应的项目文件。在github.com目录下。

五,此外附上我用过的一些资料

尚硅谷韩顺平Go语言核心编程

redis

一些项目

学习脑图

一些资源

激活goland

Git手册

Golang标准库文档

go学习文档

可以考虑 http://tour.studygolang.com 以及 http://books.studygolang.com/gobyexample/

https://www.json.cn/#

https://www.oschina.net/search?scope=project&q=golang

1.开源项目总结

开源项目

docker

golang

kubernetes

etcd

beego

martini

codis

delve

GO web

beego

GO语框架gin中文中档

以上是我上周的进展,下周继续努力

i)

codis

delve

GO web

beego

GO语框架gin中文中档

以上是我上周的进展,下周继续努力

实习第一周(Golang)相关推荐

  1. 远程实习第一周学习总结

    远程实习第一周学习总结 本周的主要学习内容内容如下: 1.掌握AndroidStudio,项目结构以及SDK 2.掌握Git以及项目忽略表 3.熟悉Android 设计规范:Material Desi ...

  2. 创新实验室实习生每周工作总结【实习第一周】

    实习的第一周,我满怀着对实验室的好奇.兴奋和敬畏以及对自己能力的担忧度过了.实验室的学长学姐们对我们都很友好,只是他们好像很忙,我遇到不能理解的问题时也不好去打扰他们,也许这是我和人相处上的不足吧. ...

  3. java实习第一周周报,大学生实习周报

    无论学习什么专业,从事什么职业,我们都需要提前实习啦,把理论知识结合起来运用到实践当中去.下面是由出国留学网小编为大家整理的"大学生幼儿园实习周报十周",仅供参考,欢迎大家阅读. ...

  4. 【实习】实习第一周周报

    一.概述 本系列为[实习]系列文章,对该系列文章的说明参见[实习]实习系列文章说明.本文为该系列文章中的 周报. 二.趣事 2.1 制度规范 入职第一天就感觉到了公司的制度规范,进入公司的第一天便有人 ...

  5. Android实习第一周总结,浅谈工作与学校的区别,以及工作心得,学习到的东西。

    前言: 从今年的6月开始对自己的未来迷茫,自己在大学自学Android一年了,在校期间做过一些小项目,在工作之前,我可能跟别人很自豪的说我做的项目是个大项目,但是在正式工作,接触到真正的上线项目之后, ...

  6. java 顶岗实习第一周周记

    对项目中的用户添加权限操作: 1. 设计数据库 2. 编写后台接口 3.对于接口的实现 由于项目中并没有应用到关于权限的框架,导致不同的用户登录到系统中所有人的操作均为一致的,无法提高用户的使用性,从 ...

  7. 第一周周工作总结及计划表

    周工作总结及计划表 姓   名 张苗 学   号 11303080405 入 职 时 间 2014/9/16 本周已完成工作内容及总结 软件工程与计算I的前三道题中,第一题已完成三版本,第二题目前被我 ...

  8. Android实习周记:第一周,井底之蛙上岸

    本周一,5月4日,我决定开始总结记录 Android 实习的收获. 1.实习生活流水账 由于公司距离学校较远,每天七点就要起床,洗漱.早点后,大概一个半小时刚好到公司.我每次都是九点前到,那时候公司人 ...

  9. 初创公司怎么做销售数据分析_我在数据科学初创公司实习的第一周

    初创公司怎么做销售数据分析 There is no better teacher than experience. No matter how many stories a person hears ...

最新文章

  1. Redis的数据结构
  2. 疯狂JAVA讲义---第十二章:Swing编程(五)进度条和滑动条
  3. R语言入门第四集 实验三:数据可视化
  4. python爬快手个人介绍个性_快手个性个人介绍句子签名 快手自己介绍模板句子...
  5. linux io体系结构,Linux IO体系结构
  6. django常用的模型字段类型和常用的查询
  7. cmd打开java文件夹_Java用CMD打开指定文件和文件夹
  8. 在c语言中log函数的作用,C++_在C语言中使用对数函数的方法,C语言log()函数:返回以e为底的 - phpStudy...
  9. hadoop loadBalance源码分析
  10. [转]Windows 7 蓝屏后获取 MEMORY.DMP 文件及注意事项
  11. java适配器有哪些_Java中适配器模式(Adapter)是什么? 适配器模式(详解)
  12. xml绑定省市,并实现二级联动
  13. ALPHACAM Desinger 2020.0中文破解版 64位
  14. IOS开发之——AFN-文件下载(03)
  15. 解读 AppStore 新功能:自定义产品页面和 A/B Test 工具
  16. Python程序员面试技巧
  17. Bip44确定性算法的Java实现库(Android和java平台都可以使用)
  18. 史上最全的iOS开源项目分类汇总没有之一
  19. 《矛盾论》与《实践论》
  20. 十大热门职位公布 高薪行业一目了然

热门文章

  1. 输入代码自动生成流程图_厉害了,这个工具能用伪代码生成流程图
  2. python中值滤波去除椒盐噪声_python 中值滤波,椒盐去噪,图片增强实例
  3. python的类方法_python 如何调用类的方法
  4. centos下rmp包离线下载
  5. 火力发电厂与变电站设计防火规范_2019年《建筑设计防火规范》新版征求意见稿...
  6. vscode创建工作区_区民政局党员干部下沉社区,积极参与文明创建工作
  7. c#输出一个平行四边形_如果Java 和 C# 同时出现,生态也差不多,你选择谁?
  8. android drawableleft 垂直居中,Android TextView前加图标垂直居中第一行(仿大众点评购买须知/提示语)...
  9. python中的json_简单介绍Python中的JSON使用
  10. 字符串中斜杠换行注意事项之-多余空格