Skip to content

Packages

Importing

import "fmt"
import "math/rand"

Same as

import (
  "fmt"        // gives fmt.Println
  "math/rand"  // gives rand.Intn
)

See: Importing

Aliases

import r "math/rand"

import (
    "fmt"
    r "math/rand"
)

r.Intn()

Packages

package main

// An internal package may be imported only by another package
// that is inside the tree rooted at the parent of the internal directory
package internal

See: Internal packages

Exporting names

// Begin with a capital letter
func Hello () {
  ยทยทยท
}

See: Exported names

Comments