goinstall
【背景】
折腾:
【记录】go语言中通过log4go实现同时输出log信息到log文件和console
期间,以:
http://code.google.com/p/log4go/
为例,如何安装第三方包。
【折腾过程】
1.看到:
http://code.google.com/p/log4go/
中有一句安装的:
goinstall log4go.googlecode.com/hg
所以去试试:
结果我此处根本没有goinstall:
E:\Dev_Root\go\src\EmulateLoginBaidu>goinstall
'goinstall' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
2.参考:
Installing Third-Party Packages
发现,其实是
go install
所以去试试:
结果找不到:
E:\Dev_Root\go\src\EmulateLoginBaidu>go install log4go.googlecode.com/hg
can't load package: package log4go.googlecode.com/hg: cannot find package "log4go.googlecode.com/hg" in any of:
E:\dev_install_root\Go\src\pkg\log4go.googlecode.com\hg (from $GOROOT)
E:\Dev_Root\go\src\log4go.googlecode.com\hg (from $GOPATH)
3.参考:
How to install golang 3rd-party projects from download sources?
先去试试那个go get。
但是是之前,先去看看go有哪些命令:
E:\Dev_Root\go\src\EmulateLoginBaidu>go help
Go is a tool for managing Go source code. Usage: go command [arguments] The commands are: build compile packages and dependencies
clean remove object files
doc run godoc on package sources
env print Go environment information
fix run go tool fix on packages
fmt run gofmt on package sources
get download and install packages and dependencies
install compile and install packages and dependencies
list list packages
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet run go tool vet on packages Use "go help [command]" for more information about a command. Additional help topics: gopath GOPATH environment variable
packages description of package lists
remote remote import path syntax
testflag description of testing flags
testfunc description of testing functions Use "go help [topic]" for more information about that topic. E:\Dev_Root\go\src\EmulateLoginBaidu>
可见,get是下载并安装对应的包和依赖。
所以直接去试试:
E:\Dev_Root\go\src\EmulateLoginBaidu>go get log4go.googlecode.com/hg
package log4go.googlecode.com/hg: invalid Google Code import path: use code.google.com/p/log4go instead
4.很明显,不支持改地址,所以换用其所提示的:
code.google.com/p/log4go
结果,又出现”exec: "hg": executable file not found in %PATH%”的错误:
【已解决】go语言用go get去安装第三方包出错:exec: "hg": executable file not found in %PATH%
5.另外,安装前后,看到go官网的解释:
Download and install packages and dependencies
所以先去看看其解释:
- get默认已经包含:下载和安装;
- -d:表示只下载(不继续安装)
- -fix:下载后,解析依赖关系之前,运行fix
- -u:update
7.那就去试试直接给名字,是否可以:
E:\Dev_Root\go\src\EmulateLoginBaidu>go get log4go
package log4go: unrecognized import path "log4go"
很明显,不行。。。
8.结果还是上述的:
【已解决】go语言用go get去安装第三方包出错:exec: "hg": executable file not found in %PATH%
而解决了问题,通过hg安装了此log4go。
【总结】
此处,最终是:
windows下安装了hg: 【记录】windows下安装Mercurial的hg
再去用:
go get code.google.com/p/log4go
而成功的安装了log4go的。
goinstall的更多相关文章
- 把vim当做golang的IDE
开始决定丢弃鼠标,所以准备用vim了. 那么在vim里面如何搭建golang环境呢? git盛行之下,搭建vim环境是如此简单. 而且vim搭建好了之后,基本上跟IDE没有差别. 高亮.自动补全.自动 ...
- pycharm基本设置
python新建产生标题 File and Code Templates->Python Script pycharm代码行数 Editor->General->Appearance ...
- go-vim配置
一.环境准备: 系统环境说明: [root@docker golang]# cat /etc/redhat-release CentOS Linux release (Core) [root@dock ...
- My Go Resolutions for 2017(from Russ cox's blog)
我的2017年Go决议 一年之季始于春,我认为写一些今年我希望在Go上做的东西是有意义的. 我每年的目标是帮助Go开发人员.我想确保我们在Go团队中所做的工作对Go开发者有重大的积极影响.可能听起来很 ...
- some settings for spacemacs golang
spacemacs 中的 golang配置 spacemacs 中的 golang layer 已经有很多默认的配置了, 但是都是针对在 GOPATH 下的配置. 如果你的项目不再默认 的 GOPAT ...
- axublog 1.05代码审计
00x1 安装漏洞 install/cmsconfig.php function step4(){ $root=$_POST["root"]; $dbuser=$_POST[&qu ...
- Go第十一篇之编译与工具
Go 语言的工具链非常丰富,从获取源码.编译.文档.测试.性能分析,到源码格式化.源码提示.重构工具等应有尽有. 在 Go 语言中可以使用测试框架编写单元测试,使用统一的命令行即可测试及输出测试报告的 ...
- 26 About the go command go命令行
About the go command go命令行 Motivation Configuration versus convention Go's conventions Getting star ...
- Golang开发环境搭建-Vim篇
一.一个干净的环境 找个干净的基础环境,方便确认每个搭建步骤后的效果: Ubuntu 14.04 x86_64 vim version 7.4.52 go version go1.4beta1 lin ...
随机推荐
- 水池接雨水的经典问题I&II
https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/trapping-rain-water- ...
- HDU2452 Navy maneuvers 记忆化搜索
这题目意思能忍?读了半年,乱七八糟的 记忆化搜索 拖拖的,dp[i][0]代表以获得最小值为目标的船以i为起点.dp[i][1]代表以获得最大值为目标的船以i为起点.接下来暴力枚举入度为0的点为起点, ...
- LINUX设备驱动程序笔记(一)设备驱动程序简单介绍
<一>:设备驱动程序的作用 从一个角度看,设备驱动程序的作用在于提供机制,而不是策略. 在编写驱动程序时,程序猿应该特别注意以下这个基本概念:编写訪问硬件的内核代码时,不要给用户强加不论什 ...
- BOOST_CLASS_EXPORT
用基类的指针去转存派生类时除了上一篇boost::serialization 用基类指针转存派生类(错误多多,一波三折)之外.还有还有一种更简单的方法: 用BOOST_CLASS_EXPORT宏. 以 ...
- HDU2665 kth number 线段树做法
题意:求区间第k小 思路: 线段树 每个节点上保存 当前区间已经排序好的序列 (归并一下就好了嘛 复杂度 O(l)的) 这样建树的时空复杂度都是 O(nlogn)的 对于 每次询问 二分一个答案 在树 ...
- leetcode 10 Regular Expression Matching(简单正则表达式匹配)
最近代码写的少了,而leetcode一直想做一个python,c/c++解题报告的专题,c/c++一直是我非常喜欢的,c语言编程练习的重要性体现在linux内核编程以及一些大公司算法上机的要求,pyt ...
- 用JS把复选框做成单选框,左显示div,右隐藏div
<input type="checkbox" name="checkname" onclick="check(this)"/>左 ...
- 洛谷T21776 子序列
题目描述 你有一个长度为 nn 的数列 \{a_n\}{an} ,这个数列由 0,10,1 组成,进行 mm 个的操作: 1~l~r1 l r :把数列区间 [l, r][l,r] 内的所有数取反. ...
- Codeforces 701A. Cards(水)
A. Cards time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...
- 将本地的代码上传到网上SVN库
使用VisualSVN Server创建版本库: https://jingyan.baidu.com/article/db55b609f6aa724ba20a2f6c.html 最详细的教程: htt ...