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

Teach you how to import golang.org packages

藏色散人
藏色散人forward
2020-09-05 09:25:422403browse

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!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete