$ go --help Go is a tool for managing Go source code.
Usage:
go <command> [arguments]
The commands are:
bug start a bug report build compile packages and dependencies clean remove object files and cached files doc show documentation for package or symbol env print Go environment information fix update packages to use new APIs fmt gofmt (reformat) package sources generate generate Go files by processing source get add dependencies to current module and install them install compile and install packages and dependencies list list packages or modules mod module maintenance run compile and run Go program test test packages tool run specified go tool version print Go version vet report likely mistakes in packages
Use "go help <command>" for more information about a command.
Additional help topics:
buildconstraint build constraints buildmode build modes c calling between Go and C cache build and test caching environment environment variables filetype file types go.mod the go.mod file gopath GOPATH environment variable gopath-get legacy GOPATH go get goproxy module proxy protocol importpath import path syntax modules modules, module versions, and more module-get module-aware go get module-auth module authentication using go.sum packages package lists and patterns private configuration for downloading non-public code testflag testing flags testfunc testing functions vcs controlling version control with GOVCS
Use "go help <topic>" for more information about that topic.
$ go mod init noah.io/ark/rest $ vi main.go package main
import ( "encoding/json" "net/http" )
var users = map[string]*User{}
type User struct { Nickname string `json:"nickname"` Email string `json:"email"` }
func main() { http.HandleFunc("/users", func(wr http.ResponseWriter, r *http.Request) { switch r.Method { case http.MethodGet: // 조회 json.NewEncoder(wr).Encode(users) // 인코딩 case http.MethodPost: // 등록 var user User json.NewDecoder(r.Body).Decode(&user) // 디코딩
$ sudo add-apt-repository ppa:longsleep/golang-backports Golang 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17 and 1.18 PPA for Ubuntu 더 많은 정보: https://launchpad.net/~longsleep/+archive/ubuntu/golang-backports [ENTER]을 눌러 진행하거나 Ctrl-c를 눌러 추가하는것을 취소합니다.
그래도 1.17을 기준으로 설치 되는 듯.
$ sudo apt-get install golang 패키지 목록을 읽는 중입니다... 완료 의존성 트리를 만드는 중입니다 상태 정보를 읽는 중입니다... 완료 다음 패키지가 자동으로 설치되었지만 더 이상 필요하지 않습니다: golang-1.10-go golang-1.10-race-detector-runtime golang-1.10-src golang-1.11-doc golang-1.11-go golang-1.11-race-detector-runtime golang-1.11-src golang-race-detector-runtime Use 'sudo apt autoremove' to remove them. 다음의 추가 패키지가 설치될 것입니다 : golang-1.17 golang-1.17-doc golang-1.17-go golang-1.17-src golang-doc golang-go golang-src 제안하는 패키지: bzr | brz mercurial subversion 다음 새 패키지를 설치할 것입니다: golang golang-1.17 golang-1.17-doc golang-1.17-go golang-1.17-src golang-doc 다음 패키지를 업그레이드할 것입니다: golang-go golang-src 2개 업그레이드, 6개 새로 설치, 0개 제거 및 1개 업그레이드 안 함. 72.0 M바이트 아카이브를 받아야 합니다. 이 작업 후 424 M바이트의 디스크 공간을 더 사용하게 됩니다.