go 写一个简单的模块
2018-06-22 本文已影响22人
wyrover
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)
}