Hello Ocean! ๐ŸŒผ

go ์–ธ์–ด ์‹œ์ž‘ํ•˜๊ธฐ ๋ณธ๋ฌธ

Algorithm

go ์–ธ์–ด ์‹œ์ž‘ํ•˜๊ธฐ

bba_dda 2020. 7. 7. 11:57
๋ฐ˜์‘ํ˜•

์„ค์น˜ ํ›„์— 

cmd -> go , go env ๋‘๊ฐœ ๋ช…๋ น์–ด๋กœ ์ž˜ ์„ค์น˜๋˜์—ˆ๋Š”์ง€ ํ™•์ธ

 

go ์ฝ”๋“œ๋ฅผ ์ €์žฅํ•  ํด๋”๋ฅผ ์›ํ•˜๋Š” ์œ„์น˜์— ์ƒ์„ฑํ•œ ํ›„ ํ™˜๊ฒฝ๋ณ€์ˆ˜ ๋“ฑ๋ก (GOPATH)

 

๋ฉ”๋ชจ์žฅ์œผ๋กœ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•œ ํ›„ .go ํ™•์žฅ์ž๋กœ ์ €์žฅ 

 

cmd์—์„œ ์œ„์น˜๋ฅผ ์ฝ”๋“œ๊ฐ€ ์ €์žฅ๋œ ํด๋”๋กœ ์˜ฎ๊ธด ํ›„์— 

go build test.go -> go run test.go  (binary ์ฝ”๋“œ ์ƒ์„ฑ ํ›„์— ์‹คํ–‰)

go run test.go (binary ์ฝ”๋“œ ์ƒ์„ฑํ•˜์ง€ ์•Š๊ณ  ์‹คํ–‰)

go install test.go (๊ธฐ๋ณธ binํด๋”์— ์ƒ์„ฑ ํ›„ ์‹คํ–‰)

 

 

package main //๊ธฐ๋ณธ ํŒจํ‚ค์ง€ 

import "fmt" //๊ธฐ๋ณธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ 

func main() {

    fmt.Println("hello world!")

}

 

๊ณต์‹ ๋ฌธ์„œ : https://golang.org

 

The Go Programming Language

Download Go Binary distributions available for Linux, macOS, Windows, and more. // You can edit this code! // Click here and start typing. package main import "fmt" func main() { fmt.Println("Hello, ไธ–็•Œ") } Hello, World! Conway's Game of Life Fibonacci

golang.org

์˜จ๋ผ์ธ ์ปดํŒŒ์ผ๋Ÿฌ : https://play.golang.org

 

The Go Playground

package main import ( "fmt" ) func main() { fmt.Println("Hello, playground") } About the Playground The Go Playground is a web service that runs on golang.org's servers. The service receives a Go program, vets, compiles, links, and runs the program inside

play.golang.org

- ๋• ํƒ€์ดํ•‘ ๋ฐฉ์‹์ด๋‹ค 

https://nesoy.github.io/articles/2018-02/Duck-Typing

๋ฐ˜์‘ํ˜•