Home > Backend Development > Golang > Teach you how to import golang.org packages

Teach you how to import golang.org packages

藏色散人
Release: 2020-09-05 09:25:42
forward
2469 people have browsed it

The following column golang tutorial will introduce how to import golang.org packages. I hope it will be helpful to friends in need!

Teach you how to import golang.org packages

Import the package of golang.org

Golang is Google’s open source programming language. After using it for a long time, you will become aware of this fact. Deep experience

For example, when go get some packages, it fails.

Teach you how to import golang.org packages

How to solve the problem that the package under domestic golang.org cannot be downloaded to the local GOPATH?

Example: github.com/colinmarc/hdfs This package uses part of the functions of golang.org/x/crypto

Reason: golang.org parses out the IP of Google, "of course Should "Access Denied"

method, find the github mirror package:

Teach you how to import golang.org packages

Steps: git clone [mirror address]. Then under the first GOPATH Create new folders golang.org and x in sequence (the golang.org folder should be at the same level as the github.com folder). Then copy the downloaded crypto folder.

Finally: The package imported by go get github.com/colinmarc/hdfs can be called normally. Import the corresponding package according to your actual situation. The steps are basically similar. The key is to find the image you want.

The above is the detailed content of Teach you how to import golang.org packages. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.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