Skip to content

Latest commit

Β 

History

History
35 lines (22 loc) Β· 1.37 KB

Install_Go.md

File metadata and controls

35 lines (22 loc) Β· 1.37 KB

μ„œλ²„μ— golang μ„€μΉ˜

  • golang μ„€μΉ˜ 파일 λ‹€μš΄λ‘œλ“œ

    • cd /usr/local/src : ν•΄λ‹Ή ν΄λ”λ‘œ 이동

    • sudo curl -O https://dl.google.com/go/go1.15.5.linux-amd64.tar.gz : go 1.15.5 λ‹€μš΄λ‘œλ“œ

    • go λ‹€μš΄λ‘œλ“œ μ‚¬μ΄νŠΈμ—μ„œ μ΅œμ‹ λ²„μ „κ³Ό 이전버전 λ‹€μš΄λ‘œλ“œ κ°€λŠ₯

  • λ‹€μš΄λ‘œλ“œ 파일 μ••μΆ•ν’€κΈ°

    • sudo tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz

    • cd /usr/local/go/bin ν΄λ”λ‘œ 이동 ν›„, ./go version μž…λ ₯ν•΄μ„œ go version go1.15.5 linux/amd64κ°€ 좜λ ₯되면 성곡

  • ν™˜κ²½λ³€μˆ˜ μ„€μ •

    • vi ~/.bash_profile μž…λ ₯ ν›„, μ›ν•˜λŠ” pathλ₯Ό 지정 (vi λͺ…λ Ήμ–΄λ₯Ό μ΄μš©ν•΄μ„œ μž…λ ₯ν•˜κ³  μ €μž₯)

      go 싀행을 μ–΄λŠκ³³μ—μ„œλ“  자유둭게 ν•˜κΈ° μœ„ν•΄μ„œ μ„€μ •ν•œλ‹€.

      • export GOPATH=$HOME/go

      • export PATH=$PATH:$GOPATH/bin

      • export PATH=$PATH:/usr/local/go/bin

    • source ~/.bash_profile μž…λ ₯ν•΄μ€˜μ•Ό 반영됨 ✨

μ„€μΉ˜ μ‹œ 이슈

  • go build λ˜μ§€μ•Šμ€ 경우
    • go : go.mod file not found in current directory on any parent directory; see 'go help modules'
    • ν•΄κ²° : go env -w GO111MODULE=auto λͺ…λ Ήμ–΄ μž…λ ₯
  • go 파일 싀행을 μœ„ν•΄ κ΄€λ ¨ package λ‹€μš΄λ‘œλ“œ μ‹œ, git λͺ…λ Ήμ–΄ μΈμ‹μ•ˆλ˜λŠ” 경우
    • git μ„€μΉ˜ν•˜λ©΄ package get κ°€λŠ₯
    • centos7 κΈ°μ€€, yum install git λͺ…λ Ήμ–΄λ₯Ό 톡해 git μ„€μΉ˜