在本地目录中安装软件包 [英] Installing packages in a local directory

查看:111
本文介绍了在本地目录中安装软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在本地目录中安装软件包(带有go get...的软件包)的最佳实践是什么?

What is the best practice to install packages (those with go get...) in a local directory?

示例:我想尝试 Revel 网络框架,但是我不想使我的工作变得混乱安装在/usr/local/go.

Example: I'd like to try out the Revel web framework, but I don't want to clutter my go installation at /usr/local/go.

通常我会说首页上写的sudo go get github.com/robfig/revel,但这会将它安装在/usr/local/go/src/pkg/...下.

Normally I'd say sudo go get github.com/robfig/revel as written on the home page, but that would install it beneath /usr/local/go/src/pkg/....

是否有一种简单的方法(例如)go get --local ...并将软件包放在当前(子)目录中?

Is there an easy way to say (for example) go get --local ... and have the package in the current (sub) directory?

推荐答案

您可以导出环境变量GOPATH.对我来说是~/local/lib/go.此文件夹包含binpkgsrc子文件夹,因此就像/usr/local/go一样. go-工具将自动将软件包下载,构建并安装到该目录中.

You can export the env variable GOPATH. For me it is ~/local/lib/go. This folder has the subfolders bin, pkg and src, so it's just like /usr/local/go. The go-tool will then automatically download , build and install packages into this directory.

这篇关于在本地目录中安装软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆