티스토리 뷰
Have you heard about 'Go'?, I don't mean you have to go out haha. 'Go' is kind a name of language which makes me feel happy in these-day. Go is made by 'Goolge' and a kind of compile language. Literally, Go has strong points like garbage collection and concurrency. A number of Developers have been struggling to handle memory and Java developers are getting increase due to this reason. However Go is familiar with C developers I guess. Anyway Go project is started since 2007 in Google and 1.8 version was released in Feb, 2017. Briefly, I would like explain What is the purpose.
# Purpose of Go
Go tries to take an advantage of static compiler language like efficiency and easiness of dynamic language. Software market is getting bigger and bigger and requiring the people who are able to developer software program because of fast growing in technologies area.
There is 4 parts of purpose officially.
- Safety : Type and memory safety.
- Concurrency and prominent libraries of communication.
- Effective garbage collection
- Compile time
Well, What are you going to do if you read till it?, Yes, make a code like 'Hello World'.
package main import "fmt" func main() { fmt.Println("Hello, World") }
What strikes me out when I made a code is 'is it java?' But it is the just start. We can see more about Go's favor and can't forget it if we use it once.
# Understanding environment
Go developers are used to maintain their codes in single workspace. Each repository includes one more package and each package consists of several go source files. The path of packages will make a decision where we should import. Here is structure of workspace.
- src : Location of go sources
- pkg : Object of packages
- bin : execution files like commands.
bin/
hello # command 실행 프로그램
outyet # command 실행 프로그램
pkg/
linux_amd64/
github.com/golang/example/
stringutil.a # 패키지 객체
src/
github.com/golang/example/
.git/ # Git 저장소 메타 데이터
hello/
hello.go # command 소스
outyet/
main.go # command 소스
main_test.go # 테스트 소스
stringutil/
reverse.go # 패키지 소스
reverse_test.go # 테스트 소스
golang.org/x/image/
.git/ # Git 저장소 메타 데이터
bmp/
reader.go # 패키지 소스
writer.go # 패키지 소스
Assume, you install Go compiler in you PC and set up the path for GOROOT. You can see the result if you type 'go env' in everywhere in you PC.
$ go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Administrator\source\goproject
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
but you have to set up the GOPATH for taking reference with library packages. Make the folder that you want to work with Go and set up the path like below.
$ mkdir $HOME/work
$ export GOPATH=$HOME/work
You code will be a main program other wise library package to refer from other main program. Also you can take some library from github which is updated from somebody.
# To be Gopher~!
Gopher
Do you know what it is? It's is kind a rat but pretty cute. Go is able to build based arm. So you can utilize it in arm target though. Don't you feel exciting? If you are developer based on linux, you can use syscall api easier than other languages. Not sure how much better the language than others, but Go is marvelous language. I hope that I will be a gopher !!!
# Reference
https://golang.org
https://en.wikipedia.org/wiki/Go_(programming_language)
'Technology > Golang' 카테고리의 다른 글
API 웹 서버 구축을 위해선 echo + firebase 가 찰떡! (0) | 2023.01.05 |
---|---|
firebase 데이터를 go를 이용해 뽑아내기 (1) | 2022.05.13 |
Go plugin ? C library in Go ? (0) | 2017.06.01 |
GB Tool for dependency (0) | 2017.05.21 |
HTTP Over Unix Socket (0) | 2017.05.17 |