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

(새 문서: ==개요== ;go mod 헬로우 월드 ;go mod init 헬로우 월드 * $HOME/hello에서 go mod init 하고 hello.go 파일 만들고 실행 <syntaxhighlight lang='bash'> mkdir hello cd...)
 
 
(같은 사용자의 중간 판 6개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
{{소문자}}
;go mod 헬로우 월드
;go mod 헬로우 월드
;go mod init 헬로우 월드
;go mod init 헬로우 월드
* $HOME/hello에서 go mod init 하고 hello.go 파일 만들고 실행
* $HOME/hello에서 go mod init 하고 hello.go 파일 만들고 실행


{{소스헤더|한방 스크립트}}
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
mkdir hello
mkdir hello
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
17번째 줄: 20번째 줄:
go run .
go run .
</syntaxhighlight>
</syntaxhighlight>
{{소스헤더|실행예시}}
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
testuser@localohst:~$ mkdir hello
testuser@localhost:~$ mkdir hello
testuser@localohst:~$ cd hello
testuser@localhost:~$ cd hello
testuser@localohst:~/hello$ go mod init example/hello
testuser@localhost:~/hello$ go mod init example/hello
go: creating new go.mod: module example/hello
go: creating new go.mod: module example/hello
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
testuser@localohst:~/hello$ cat <<EOF > hello.go
testuser@localhost:~/hello$ cat go.mod
module example/hello
 
go 1.17
</syntaxhighlight>
<syntaxhighlight lang='console'>
testuser@localhost:~/hello$ cat <<EOF > hello.go
> package main
> package main
> import "fmt"
> import "fmt"
33번째 줄: 44번째 줄:
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
testuser@localohst:~/hello$ go run .
testuser@localhost:~/hello$ go run .
Hello, World!
Hello, World!
</syntaxhighlight>
</syntaxhighlight>


==같이 보기==
==같이 보기==
* [[go.mod]]
* [[go mod init]]
* [[go mod init]]
* [[go mod tidy 헬로우 월드]]
* [[Go 헬로우 월드 빌드·실행]]
* [[Go 헬로우 월드 빌드·실행]]



2021년 9월 17일 (금) 11:59 기준 최신판

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@localhost:~$ mkdir hello
testuser@localhost:~$ cd hello
testuser@localhost:~/hello$ go mod init example/hello
go: creating new go.mod: module example/hello
testuser@localhost:~/hello$ cat go.mod
module example/hello

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

2 같이 보기[ | ]

3 참고[ | ]

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