mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-11-04 21:43:42 +00:00
ch10: fix code path
This commit is contained in:
parent
c683de9b81
commit
442dd58ee4
@ -10,8 +10,8 @@ import _ "image/png" // register PNG decoder
|
||||
|
||||
標準庫的image圖像包包含了一個`Decode`函數,用於從`io.Reader`接口讀取數據併解碼圖像,它調用底層註冊的圖像解碼器來完成任務,然後返迴image.Image類型的圖像。使用`image.Decode`很容易編寫一個圖像格式的轉換工具,讀取一種格式的圖像,然後編碼爲另一種圖像格式:
|
||||
|
||||
<u><i>gopl.io/ch10/jpeg</i></u>
|
||||
```Go
|
||||
gopl.io/ch10/jpeg
|
||||
// The jpeg command reads a PNG image from the standard input
|
||||
// and writes it as a JPEG image to the standard output.
|
||||
package main
|
||||
|
@ -69,9 +69,8 @@ $ go run quoteargs.go one "two three" four\ five
|
||||
|
||||
針對不同操作繫統或CPU的交叉構建也是很簡單的。隻需要設置好目標對應的GOOS和GOARCH,然後運行構建命令卽可。下面交叉編譯的程序將輸出它在編譯時操作繫統和CPU類型:
|
||||
|
||||
<u><i>gopl.io/ch10/cross</i></u>
|
||||
```Go
|
||||
gopl.io/ch10/cross
|
||||
|
||||
func main() {
|
||||
fmt.Println(runtime.GOOS, runtime.GOARCH)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user