我安装的是最新的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
, on
和auto(默认值)
。
-
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=on
C:\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.
USAGE
bee command [arguments]
AVAILABLE COMMANDS
version Prints the current Bee version
migrate Runs database migrations
api Creates a Beego API application
bale Transforms non-Go files to Go source files
fix Fixes your application by making it compatible with newer versions of Beego
pro Source code generator
dlv Start a debugging session using Delve
dockerize Generates a Dockerfile for your Beego application
generate Source code generator
hprose Creates an RPC application based on Hprose and Beego frameworks
new Creates a Beego application
pack Compresses a Beego application into a single file
rs Run customized scripts
run Run the application by starting a local development server
server serving static content over HTTP on port
Use bee help [command] for more information about a command.
ADDITIONAL HELP TOPICS
Use bee help [topic] for more information about that topic.
又成功了,至次就成功了吗?没有,为啥?
bee下载到那儿了,不知道,罪过罪过,在我的go语言安装目录的,src ,pkg等下面都没找到,这难道没安上?还是哪里有问题。各种查找。最后终于找到一个解决办法。需要自己创建一个工作区目录。为什么不使用安装目录,是因为要保证安装目录的纯洁性。
打开一看,咋跑C盘去了,仔细一看是自己把代码敲错了,自动添加到C盘了,
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)
最后
你要问前端开发难不难,我就得说计算机领域里常说的一句话,这句话就是『难的不会,会的不难』,对于不熟悉某领域技术的人来说,因为不了解所以产生神秘感,神秘感就会让人感觉很难,也就是『难的不会』;当学会这项技术之后,知道什么什么技术能做到什么做不到,只是做起来花多少时间的问题而已,没啥难的,所以就是『会的不难』。
我特地针对初学者整理一套前端学习资料,免费分享给大家,戳这里即可免费领取
义、实战项目、讲解视频,并且会持续更新!**
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)
[外链图片转存中…(img-lXsPzSBV-1713779447273)]
最后
你要问前端开发难不难,我就得说计算机领域里常说的一句话,这句话就是『难的不会,会的不难』,对于不熟悉某领域技术的人来说,因为不了解所以产生神秘感,神秘感就会让人感觉很难,也就是『难的不会』;当学会这项技术之后,知道什么什么技术能做到什么做不到,只是做起来花多少时间的问题而已,没啥难的,所以就是『会的不难』。
我特地针对初学者整理一套前端学习资料,免费分享给大家,戳这里即可免费领取
[外链图片转存中…(img-gWyxaesk-1713779447273)]