You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
docs/go/01-get-started/
Go 語言簡介 圖片來源:Gophers
Go 於 2007 年誕生,由 Google 創建。
Go 程式語言沒有以下語法或機制:
沒有型別繼承。 沒有 exception handling 語法(沒有 try...catch,也沒有 throw)。 沒有巨集(macro)。 沒有 enum。(可以用具名常數) 沒有局部函式(partial functions)。 不支援變數延遲估值(lazy variable evaluation)。 沒有運算子多載(operator overloading)。 沒有樣式匹配(pattern matching)。 沒有內建的 GUI 框架或套件。 如欲了解為什麼 Go 不支援某些語言特性,可參閱官方文件:Go FAQ。
Go 的優點與強項:
很適合開發 CLI 和伺服器端應用程式。 函式可回傳多個值。於是,函式可以輕易回傳錯誤,故也就不需要 throw exceptions 了。就如 Rob Pike 於 2015 年發表的文章所說,errors are values。直到現在(2024 年)依然如此。 Concurrency。非同步呼叫的語法非常簡單直觀,跟循序呼叫的語法幾乎一樣。 單元測試在 Go 語言中是一級公民:測試程式的檔案名稱一律命名為「欲測試之程式檔名_test.go」,而且兩個檔案要放在同一個目錄下。例如 hello.go 的測試程式會叫做 hello_test.go。 標準函式庫提供了常用的工具套件,包括網路通訊、HTTP、序列化、加解密等等。 如果需要開發跨平台的 GUI 應用程式,可以試試開源專案 Wails。
https://huanlin.cc/docs/go/01-get-started/
Beta Was this translation helpful? Give feedback.
All reactions