Home  >  Article  >  Backend Development  >  How to import packages in golang

How to import packages in golang

尚
Original
2019-12-25 10:17:302550browse

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

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")

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!

Statement:
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