Syntax

Go Import Packages Syntax

In Go, import packages: imports standard packages — import ( "fmt" "os" )

Quick Answer

Syntax
import ( "fmt" "os" )
GoSyntax

Import Packages

Code example
import ( "fmt" "os" )

Imports standard packages.

Learn More

How to import packages in Go

  1. Open your Go file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Go Import Packages Syntax

Use import ( "fmt" "os" ).

Related Syntax References

Frequently asked questions

What is the Go syntax for import packages?

Use this pattern: import ( "fmt" "os" )

Can I copy this Go code example?

Yes. Use Copy code and adapt the example to your program.

Is this Go syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify