Uuntu20.04 Golang

Screenshot from 2021-10-16 14-21-21.png

cd /home/ub1/ダウンロード
go1.17.2.linux-amd64.tar.gz
Screenshot from 2021-10-16 14-34-23.png
sudo tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz
Screenshot from 2021-10-16 14-36-03.png


git
sudo apt install git
Screenshot from 2021-10-25 09-27-31.png
export PATH=$PATH:/usr/local/go/bin
Screenshot from 2021-10-16 14-36-29.png

source ~/.bashrc
Screenshot from 2021-10-16 14-37-02.png

sudo gedit ~/.bashrc
Screenshot from 2021-10-25 09-07-36.png


go version
Screenshot from 2021-10-16 14-37-54.png

no required module provides package github.com/lib/pq: go.mod file not found in current directory or any parent directory; see 'go help modules'

git
sudo apt install git
Screenshot from 2021-10-25 09-27-31.png


go get github.com/lib/pq
Screenshot from 2021-10-25 09-31-06.png


go help modules
Screenshot from 2021-10-25 09-32-51.png

a1@a1-System-Product-Name:~/golang/01$ go help modulesModules are how Go manages dependencies.A module is a collection of packages that are released, versioned, anddistributed together. Modules may be downloaded directly from version controlrepositories or from module proxy servers.For a series of tutorials on modules, seehttps://golang.org/doc/tutorial/create-module.For a detailed reference on modules, see https://golang.org/ref/mod.By default, the go command may download modules from https://proxy.golang.org.It may authenticate modules using the checksum database athttps://sum.golang.org. Both services are operated by the Go team at Google.The privacy policies for these services are available athttps://proxy.golang.org/privacy and https://sum.golang.org/privacy,respectively.The go command's download behavior may be configured using GOPROXY, GOSUMDB,GOPRIVATE, and other environment variables. See 'go help environment'and https://golang.org/ref/mod#private-module-privacy for more information.a1@a1-System-Product-Name:~/golang/01$
 
VSCODE
https://future-architect.github.io/articles/20201117/
  1. >Go: Install/Update Tools と入力する。
Screenshot from 2021-10-25 09-32-51.png