How to import packages in golang

Release: 2019-12-25 10:17:30
Original
2497 people have browsed it

How to import packages in golang

Golang uses the syntax element of package to organize source code. All syntax visibility is defined at the package level. Compared with languages ​​such as Java and python, this is not a big deal. What an innovation, but compared with C's traditional include, it appears to be much more "advanced".

The definition and use of packages in Golang seems very simple:

Define packages through the package keyword:

package xxx
Copy after login

Use the import keyword to import the standard library package to be used or third-party dependency packages.

import "a/b/c"
import "fmt"
c.Func1()
fmt.Println("Hello, World")
Copy after login

For more golang knowledge, please pay attention to the golang tutorial column.

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

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!