1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 12:32:21 +00:00

Update ch2-02-basic.md

This commit is contained in:
wahaha 2018-08-16 15:35:37 +08:00 committed by GitHub
parent 51688cf5a3
commit 58abdc629f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,7 @@ func PrintCString(cs *C.char) {
```go ```go
package main package main
//char* cs = "hello"; //static const char* cs = "hello";
import "C" import "C"
import "./cgo_helper" import "./cgo_helper"
@ -121,11 +121,11 @@ package main
#cgo linux CFLAGS: -DCGO_OS_LINUX=1 #cgo linux CFLAGS: -DCGO_OS_LINUX=1
#if defined(CGO_OS_WINDOWS) #if defined(CGO_OS_WINDOWS)
char* os = "windows"; static const char* os = "windows";
#elif defined(CGO_OS_DARWIN) #elif defined(CGO_OS_DARWIN)
char* os = "darwin"; static const char* os = "darwin";
#elif defined(CGO_OS_LINUX) #elif defined(CGO_OS_LINUX)
char* os = "linux"; static const char* os = "linux";
#else #else
# error(unknown os) # error(unknown os)
#endif #endif