aPackage.go
package aPackage
import (
"fmt"
)
func A() {
fmt.Println("This is function A!")
}
func B() {
fmt.Println("privateConstant:", privateConstant)
}
const MyConstant = 123
const privateConstant = 21
package main
import (
"aPackage"
"fmt"
)
func main() {
fmt.Println("Using aPackage!")
aPackage.A()
aPackage.B()
fmt.Println(aPackage.MyConstant)
}
网友评论