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)
}

上一篇下一篇

猜你喜欢

热点阅读