현재 3권의 신간들인 Go Optimizations 101, Go Details & Tips 101Go Generics 101이 출간되어 있습니다. Leanpub 서점에서 번들을 모두 구입하시는 방법이 비용 대비 효율이 가장 좋습니다.

Go에 대한 많은 정보들과 Go 101 책들의 최신 소식을 얻으시려면 Go 101 트위터 계정인 @Go100and1을 팔로잉 해주세요.

More Go Related Topics

Go 101 articles mainly focus on syntax and semantics in Go. There are some other Go related topics which are not covered in Go 101. The remaining of the current article will make simple introductions to those topics and provide some web links for readers to dig more into them.

Profiling, Benchmarks and Unit/Fuzzing Tests

We can use go test command in Go Toolchain to run tests and benchmarks. Test source file names must end with _test.go. Go Toolchain also supports profiling Go programs. Please read the following articles for more details.

gccgo

gccgo is another Go compiler maintained by the Go core team. It is mainly used to verify the correctness of the standard Go compiler (gc). We can use the -compiler=gccgo build option in several Go Toolchain commands to use the gccgo compiler instead of the gc compiler. For example, go run -compiler=gccgo main.go. This option requires the gccgo program is installed. Once the gccgo program is installed, we can also use the gccgo command directly to compile Go code.

The go/* Standard Packages

The go/* standard packages provide functionalities of parsing Go source files, which are very useful to write custom Go tools. Please read go/types: The Go Type Checker and package documentation for how to use these packages.

System Calls

We can make system calls by call the functions exported by the syscall standard package. Please beware that, different from other standard packages, the functions in the syscall standard package are operating system dependent.

Go Assembly

Go functions can be implemented with Go assembly language. Go assembly language is a cross-architectures (though not 100%) assembly language. Go assembly language is often used to implement some functions which are critical for Go program execution performances.

For more details, please follow the following links.

cgo

We can call C code from Go code, and vice versa, through the cgo mechanism. Please follow the following links for details.

It is possible to use C++ libraries through cgo by wrapping C++ libraries as C functions.

Please note that using cgo in code may make it is hard to maintain cross-platform compatibility of Go programs, and the calls between Go and C code are some less efficient than Go-Go and C-C calls.

Cross-Platform Compiling

The standard Go compiler supports cross-platform compiling. By setting the GOOS and GOARCH environments before running the go build command, we can build a Windows executable on a Linux machine, and vice versa. Please read the following articles for details. In particular, since Go 1.11, Go Toolchain starts to support WebAssembly as a new kind of GOARCH. Please read this wiki article for details.

Compiler Directives

The standard Go compiler supports several compiler directives. A directive appears as a comment line like //go:DirectiveName args. For examples, we can use the go:generate directive to generate code and use the go:embed directive (introduced in Go 1.16) to embed some data files in code.

Build Constraints (Tags)

We can use build constraints to let compilers build source files selectively (a.k.a., ignore some source files). A build constraint is also called a build tag. A build constraint can appear as a comment line like // +build constraints or appear as the suffix in the base name of a source file. Please note: the new //go:build directive introduced in Go 1.17 will retire the old // +build constraints lines eventually.

More Build Modes

The go build command in Go Toolchain supports several build modes. Please run go help buildmode to show the available build modes or read the explanations for -buildmode option instead. Except the default build mode, the most used build mode may be the plugin build mode. We can use the functions in the plugin standard package to load and use the Go plugin files outputted by using the plugin build mode.


Index↡

The Go 101 프로젝트는 Github 에서 호스팅됩니다. 오타, 문법 오류, 부정확한 표현, 설명 결함, 코드 버그, 끊어진 링크와 같은 모든 종류의 실수에 대한 수정 사항을 제출하여 Go 101을 개선을 돕는 것은 언제나 환영합니다.

주기적으로 Go에 대한 깊이 있는 정보를 얻고 싶다면 Go 101의 공식 트위터 계정인 @go100and1을 팔로우하거나 Go 101 슬랙 채널에j가입해주세요.

이 책의 디지털 버전은 아래와 같은 곳을 통해서 구매할 수 있습니다.
Go 101의 저자인 Tapir는 2016년 7월부터 Go 101 시리즈 책들을 집필하고 go101.org 웹사이트를 유지 관리하고 있습니다. 새로운 콘텐츠는 책과 웹사이트에 수시로 추가될 예정입니다. Tapir는 인디 게임 개발자이기도 합니다. Tapir의 게임을 플레이하여 Go 101을 지원할 수도 있습니다. (안드로이드와 아이폰/아이패드용):
  • Color Infection (★★★★★), 140개 이상의 단계로 이루어진 물리 기반의 캐주얼 퍼즐 게임
  • Rectangle Pushers (★★★★★), 2가지 모드와 104개 이상의 단계로 이루어진 캐주얼 퍼즐 게임
  • Let's Play With Particles, 세가지 미니 게임이 있는 캐주얼 액션 게임
페이팔을 통한 개인 기부도 환영합니다.

색인: