Can I use 'go install' to install a local project that is not in the current working directory?

PHPz
Release: 2024-02-08 21:30:10
forward
1030 people have browsed it

可以使用“go install”来安装不在当前工作目录中的本地项目吗?

php editor Youzi answers your question, you can use "go install" to install local projects that are not in the current working directory. The go install command will look for projects in the src directory of GOPATH, compile them into executable files, and then install the executable files into the bin directory of GOPATH. In this way, no matter which directory the project is in, as long as the correct GOPATH is set, you can use "go install" to install and use the local project. This is a very convenient and flexible function that allows you to manage and use projects in different directories, improving development efficiency.

Question content

I am using Go and I would like to know if I can use go install to install a local project that is not in the current working directory. Specifically, I want to install a project from a different directory.

Any insights or examples on how to achieve this would be greatly appreciated.

Workaround

The following command does the job by changing directories before running go install:

go install -C /path/to/project/to/install/
Copy after login

The above is the detailed content of Can I use 'go install' to install a local project that is not in the current working directory?. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template