"Go mod init 헬로우 월드"의 두 판 사이의 차이

잔글 (Jmnote님이 Go mod 헬로우 월드 문서를 Go mod init 헬로우 월드 문서로 이동했습니다)
8번째 줄: 8번째 줄:
cd hello
cd hello
go mod init example/hello
go mod init example/hello
cat go.mod
cat <<EOF > hello.go
cat <<EOF > hello.go
package main
package main
22번째 줄: 23번째 줄:
testuser@localohst:~/hello$ go mod init example/hello
testuser@localohst:~/hello$ go mod init example/hello
go: creating new go.mod: module example/hello
go: creating new go.mod: module example/hello
</syntaxhighlight>
<syntaxhighlight lang='console'>
testuser@localohst:~/hello$ cat go.mod
module example/hello
go 1.17
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>

2021년 9월 17일 (금) 11:45 판

1 개요

go mod 헬로우 월드
go mod init 헬로우 월드
  • $HOME/hello에서 go mod init 하고 hello.go 파일 만들고 실행
mkdir hello
cd hello
go mod init example/hello
cat go.mod
cat <<EOF > hello.go
package main
import "fmt"
func main() {
    fmt.Println("Hello, World!")
}
EOF
go run .
testuser@localohst:~$ mkdir hello
testuser@localohst:~$ cd hello
testuser@localohst:~/hello$ go mod init example/hello
go: creating new go.mod: module example/hello
testuser@localohst:~/hello$ cat go.mod
module example/hello

go 1.17
testuser@localohst:~/hello$ cat <<EOF > hello.go
> package main
> import "fmt"
> func main() {
>     fmt.Println("Hello, World!")
> }
> EOF
testuser@localohst:~/hello$ go run .
Hello, World!

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}