"리눅스 Go 설치"의 두 판 사이의 차이

잔글 (Jmnote님이 우분투 go 1.12.1 설치 문서를 우분투 go 1.16.3 설치 문서로 이동했습니다)
(같은 사용자의 중간 판 하나는 보이지 않습니다)
7번째 줄: 7번째 줄:
==설치==
==설치==
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
VERSION=1.16.3
GOLANG_VERSION=1.16.3


curl -LO https://dl.google.com/go/go${VERSION}.linux-amd64.tar.gz
curl -LO https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz
tar -C /usr/local -xvzf go${VERSION}.linux-amd64.tar.gz
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:/usr/local/go/bin



2021년 4월 14일 (수) 18:12 판

  다른 뜻에 대해서는 우분투 go 1.6 설치 문서를 참조하십시오.


1 다운로드

2 설치

GOLANG_VERSION=1.16.3

curl -LO https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

echo 'export GOPATH=$HOME/go' >> ~/.bash_profile
sed '$!N; /^\(export GOPATH=.*\)\n\1$/!P; D' -i ~/.bash_profile
source ~/.bash_profile

3 테스트

user01@localhost:~$ go version
go version go1.16.3 linux/amd64
mkdir -p ~/go/src
cd ~/go/src/
echo 'package main;import "fmt";func main(){ fmt.Println("hello world")}' > hello.go
go run hello.go
go build hello.go
./hello
user01@localhost:~$ mkdir -p ~/go/src
user01@localhost:~$ cd ~/go/src/
user01@localhost:~/go/src$ echo 'package main;import "fmt";func main(){ fmt.Println("hello world")}' > hello.go
user01@localhost:~/go/src$ go run hello.go
hello world
user01@localhost:~/go/src$ go build hello.go
user01@localhost:~/go/src$ ./hello
hello world

4 같이 보기

5 참고

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