3. Vendor init your project and add gin
govendor init
govendor fetch github.com/gin-gonic/gin@v1.3
4. Copy a starting template inside your project
curl https://raw.githubusercontent.com/gin-gonic/examples/master/basic/main.go > main.go
5. Build your project
go build main.go
此时会报错:
vendor/github.com/gin-gonic/gin/binding/protobuf.go:11:2: cannot find package "github.com/golang/protobuf/proto" in any of:
/root/go/src/song/vendor/github.com/golang/protobuf/proto (vendor tree)
/usr/local/go/src/github.com/golang/protobuf/proto (from $GOROOT)
/root/go/src/github.com/golang/protobuf/proto (from $GOPATH)
vendor/github.com/mattn/go-isatty/isatty_tcgets.go:7:8: cannot find package "golang.org/x/sys/unix" in any of:
/root/go/src/song/vendor/golang.org/x/sys/unix (vendor tree)
/usr/local/go/src/golang.org/x/sys/unix (from $GOROOT)
/root/go/src/golang.org/x/sys/unix (from $GOPATH)
vendor/github.com/gin-gonic/gin/binding/default_validator.go:11:2: cannot find package "gopkg.in/go-playground/validator.v8" in any of:
/root/go/src/song/vendor/gopkg.in/go-playground/validator.v8 (vendor tree)
/usr/local/go/src/gopkg.in/go-playground/validator.v8 (from $GOROOT)
/root/go/src/gopkg.in/go-playground/validator.v8 (from $GOPATH)
解决办法:
govendor fetch gopkg.in/go-playground/validator.v8
govendor fetch github.com/golang/protobuf/proto
govendor fetch golang.org/x/sys/unix //这条不管用
代替: cd /root/go/src/song/vendor/golang.org/x
git clone https://github.com/golang/sys.git
6. run
./main
build command-line-arguments: cannot load bufio: malformed module path "bufio": missing dot in first...
来自:
wide288 的短文
使用步骤首先,从goget-ugithub.com/kardianos/govendor下载govendor工具到本地。govendor使用时,必须保证你的工程项目放在GOPATH/src目录下。在G...
来自:
benben的博客
开门见山,直接上步骤:开启gomodexportGO111MODULE=on初始化gomodmkdir/Project/ginProject&&cd/Project/ginProjec...
来自:
不忘初心,方得始终
govendor的安装与实践 govendor是Golang的依赖包管理工具,它的出现可以避免不同用户在clone同一个项目后从外部获取不同依赖库版本的问题。govendor会将项目需要的依赖包添加...
来自:
梅雨心情的博客
**方式1:**直接使用goget函数,该情况下,已经配置好go环境变量gogetgopkg.in/gin-gonic/gin.v1但是,使用该语句的时候,遇见超时的问题,可能是内网或者goget被墙...
来自:
学习小记
使用beego生成的项目,使用goland open项目之后,运行main函数后报错missing dot in first path element,在file-settings-go-go mod...
来自:
zhangkang65的专栏
<div class="post-text" itemprop="text">
<p>I use IntelliJ IDEA as golang IDE in Windows , and system environment have already set GOPATH,but IDEA can't load $GOPATH. </p>
<p>I use <code>go get github.com/astaxie/beego</code>, this package is installed correctly, but in IDEA can't import this library.</p>
<p>I have added this package in project's structure in this way:</p>
<p><img src="https://i.stack.imgur.com/ulIA2.jpg" alt="enter image description here"></p>
<p>and this project's choice “Go sdk go1.1.1 windows/amd64 ”like
<img src="https://i.stack.imgur.com/7BpvZ.jpg" alt="enter image description here"></p>
<p>how can I set GOPATH in idea?</p>
Mac 启动加载文件位置(可设置环境变量)------------------------------------------------------- (1)首先要知道你使用的Mac OS X是什...
来自:
赵磊的博客-CSDN
<div class="post-text" itemprop="text">
<p>When running <code>glide install</code> on my project, I get the following error:</p>
<pre><code>[ERROR] Error scanning github.com/golang/protobuf/proto/testdata: cannot find package "." in:
/Users/bevernie/.glide/cache/src/https-github.com-golang-protobuf/proto/testdata
[ERROR] Failed to retrieve a list of dependencies: Error resolving imports
</code></pre>
<p>When checking protobuf's source code, I can in fact see that there is no such package. I however don't directly use protobuf, so the error must come from one of the dependencies I use.</p>
<p>When running <code>glide tree</code> on my project, there is only one instance of <code>github.com/golang/protobuf/proto/testdata</code>:</p>
<pre><code>|-- github.com/golang/protobuf/proto (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
| |-- github.com/golang/protobuf/proto/test_proto (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto/test_proto)
| | |-- (Recursion) github.com/golang/protobuf/proto (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
| |-- github.com/golang/protobuf/ptypes/any (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/ptypes/any)
| | |-- (Recursion) github.com/golang/protobuf/proto (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
github.com/golang/protobuf/proto/testdata (glide get github.com/golang/protobuf/proto/testdata)
|-- github.com/golang/protobuf/ptypes/any (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/ptypes/any)
| |-- github.com/golang/protobuf/proto (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
| | |-- github.com/golang/protobuf/proto/test_proto (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto/test_proto)
| | | |-- (Recursion) github.com/golang/protobuf/proto (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
| | |-- (Recursion) github.com/golang/protobuf/ptypes/any (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/ptypes/any)
</code></pre>
<p>which doesn't really help me pinpoint the source of the problem.</p>
<p>Do you have any suggestions as of how to fix the issues?</p>
<p>My project was compiling just fine until a week or two ago (I use Docker to deploy in production, so the <code>glide install</code> was run every time and never failed before that, and I haven't added any new dependency recently). </p>
# github.com/gin-gonic/gin/bindingsrc\github.com\gin-gonic\gin\binding\default_validator.go:48:14: u...
来自:
郭枫的博客
第一步:gogetgithub.com/gin-gonic/gin假如不出现意外的话,文档目录结构应该是这样的github.com---gin-contrib---gin-gonic---golang...
来自:
杨辉勇码代码
在运行go程序时,出现了cannotfindpackage"golang.org/x/crypto/ssh/terminal"inanyof:的问题解决方案:gitclonehtt...
来自:
yanghx9013的博客
Gin下载: https://github.com/gin-gonic/gin英文文档:https://gin-gonic.com/docs/一、简介概述Gin is a HTTP web frame...
来自:
郭枫的博客
1.govendor使用#下载govendor 工具到本地go get -u -v github.com/kardianos/govendor#进入项目目录进行操作#初始化govendor init#...
来自:
qqqqll3的博客
1、安装govendorgo get -u -v github.com/kardianos/govendor2、init在项目根目录,比如我这里是tap项目,那就是进入tap目录,执行init命令go...
来自:
衣舞晨风
在kali上安装golang,结果发现了个坑。 我是直接用apt install go-lang来安装的,然后把按网上说的教程,把/usr/lib/go-1.7中的文件全部mv到了/root目录,然后...
来自:
caiqiiqi
Golang 官方并没有推荐最佳的包管理方案。到了1.5版本时代,官方引入包管理的设计,加了 vendor 目录来支持本地包管理依赖。官方 wiki 推荐了多种支持这种特性的包管理工具,如:Godep...
来自:
独一无二的小个性
文章目录静态文件下载服务端文件模版语言(1)模版语言(2)自定义模版函数静态文件packagemainimport( "github.com/gin-gonic/gin" &quo...
来自:
金丙坤
go vendor 是go 1.5 官方引入管理包依赖的方式,1.6正式引入其基本思路是,将引用的外部包的源代码放在当前工程的vendor目录下面,go 1.6以后编译go代码会优先从vendor目录...
来自:
Andes Home 千年的塔 -十年技术,风雨兼程
Golang 官方并没有推荐最佳的包管理方案。到了1.5版本时代,官方引入包管理的设计,加了 vendor 目录来支持本地包管理依赖。官方 wiki 推荐了多种支持这种特性的包管理工具,如:Godep...
来自:
Aaron_80726的博客
本文个人博客地址为:http://www.huweihuang.com/article/golang/govendor-usage/本文个人博客地址为:https://huweihuang.net/a...
来自:
胡伟煌的博客
之前的项目使用的比较古老的dep(不是godep),能够根据项目引用的第三方包的情况自动download对应的库。当然国内对于有些包的下载需要翻墙,这个dep自动下载就不靠谱了,还得配置,无奈从其他地...
来自:
lawenliu的专栏
最近使用到logrus库,但是logrus依赖于golang.org/x/crypto/ssh/terminal, 这个库在gopath下不在vendor里是不会报错的,但是添加到vendor后,会报...
来自:
梅雨心情的博客
Firstgo get -u github.com/kardianos/govendor 编译 一个 govendor 然后 添加到 path 环境变量Quick Start# 设置你的工程cd "m...
来自:
code by code
专栏地址:技术文章专栏govendor 是 go 语言依赖管理工具。安装及初始化安装:go get -u -v github.com/kardianos/govendor复制代码初始化:# Setup...
来自:
weixin_34310127的博客
Gin安装 Download and install it: $ go get gopkg.in/gin-gonic/gin.v1 Import it in your code: import “go...
来自:
码无边
1.安装gin go get github.com/gin-gonic/gin2.实例 package mainimport ( “net/http”"github.com/gin-gonic...
来自:
码无边
Govendor使用govendor 简介govendor是一个基于 vendor 机制实现的 Go 包依赖管理命令行工具。与原生 vendor 无侵入性融合,也支持从其他依赖管理工具迁移,可以很方便...
来自:
梨休休的超级无敌厉害博客
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢...
来自:
Nicky's blog
Gin 是一个 go 写的 web 框架,具有高性能的优点。官方地址:https://github.com/gin-gonic/ginhttps://www.bookstack.cn/read/gin...
来自:
OceanStar的博客
刚开始接触Go语言,所以先搭建个web框架练练手。 百度gomodbeego搜索得到的资料 一.go版本 确保go版本在1.11及以上。 二.创建项目文件夹,并初始化 cd/project mk...
来自:
不忘初心,方得始终
安装 goprotobuf1.从 https://github.com/google/protobuf/releases 获取 Protobuf 编译器 protoc(可下载到 Windows 下的二...
来自:
weixin_30732487的博客
问题:在项目中,使用了自己基于开源项目gin进行二次开发的框架,在注册路由的时候提示了一个错误信息,如下:cannot use func literal (type func(*"githu...
来自:
搞技术的奎木狼
请认真对待你遇到的每一个难题,请用心去思考并找到解决的办法。 在安装每种语言的开发环境时,你总会遇到各种各样的问题,令人搔头挠耳。这不是,当我用Go语言开发项目,用gobuildmain.g...
来自:
沉森心与思考同行
gRpc 发布了1.0版,想来试试看,发现新电脑没有装protobuf,之前装的完了记过程,又重新网上搜了一下做个记录,我的系统是ubuntu15.10获取 Protobuf 编译器 protoc我是...
来自:
unclebig小胖的专栏
安装1.go get github.com/golang/protobuf; 2.进入gopath的protobuf目录,执行make&&make install,在gopath/bin目录下生成pr...
来自:
xiongwenwu的专栏
golang使用protobuf简易教程google公司发布的一套开源编码规则,基于二进制流的序列化传输,可以转换成多种编程语言,几乎涵盖了市面上所有的主流编程语言,当然也包括Go1、安装protob...
来自:
绯浅yousa的笔记
爬虫福利一:27报网MM批量下载 点击看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成!目标网站:妹子图网环境:Python3.x相关第三方模块:requ...
来自:
Nick.Peng 的博客
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次...
来自:
程序员宜春的博客