【Go】import

import

import can be imported by combining parentheses, this is a ‘grouped’ import statement

Of course, you can also use multiple import statements

1
2
import "fmt"
import "math"

However, we still recommend the syntax of group import

1
2
3
4
5
6
7
8
9
10
package main

import (
    "fmt"
    "math"
)

func main () {
    fmt.Printf ("The square root of% d is:% d \ n", 7, math.Sqrt (7))
}

Save as hellowrold.go, the execution result:

1
2
[me@VM_0_14_centos go] # go run helloworld.go
The square root of 7 is: 2.645751
Persist in original technology sharing, your support will encourage me to continue to create!