main.go
package main // import "hell"
func main() {
helloo("AA")
}
hello.go
package main // import "hell"
import (
"fmt"
)
func helloo(aa string) {
fmt.Println("Hello " + aa)
}
쉘 - 도스창
hello$ go mod init
go: creating new go.mod: module hell
hello$ go build
hello$ .hell.exe
Hello AA
hello$
hello$ ls
디렉터리: D:\devs\pcbangstudio\workspace\hello
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2020-10-24 PM 11:13 21 go.mod
-a---- 2020-10-24 PM 11:13 2149888 hell.exe
-a---- 2020-10-24 PM 11:12 105 hello.go
-a---- 2020-10-24 PM 11:12 61 main.go
hello$
라이브러리 분리는 댓글에 적은대로 깃헙 참고하시고, 통짜 묶음으로도 잘 되는디요???
띠용~ - dc App
오 ㅋㅋㅋ 딴파일들도 package main하니깐 된다 - dc App
go run main.go 하면 에러뜨고 build하면 에러 안뜸 ㅎㅎ
hello$ go run .\hello.go .\main.go Hello AA hello$
hello$ go run . Hello AA hello$ go run ./ Hello AA hello$ ㅇㅂㅇb