顯示具有 golang 標籤的文章。 顯示所有文章
顯示具有 golang 標籤的文章。 顯示所有文章

2016年2月10日 星期三

[Go] Go IDE 使用心得

使用 Sublime 3 用了一陣子,Sublime 的 GoSublime plugin 支援 code highlight, completion 以及 9o build 等許多功能, 使用下來覺得很好用。之前也使用過 github 出品的 Atom 編輯器與其 go-plug plugin,功能跟 gosublime 差不多,更增添了幾個的 go tools 的 support ,但因為我實在很不習慣他的美感編排就放棄了!  隨著 Code 越寫越多, 與 functions 越寫越細,越覺得 Sublime 3 是不夠用 。

除了文字編輯器般的 IDE 還有更便利的 IDE 嗎!?

從這個想法出發我找了兩個 IDE , 一個是 Android Studio 所使用的 IntelliJ 另一個是 Eclipse。 這兩個都是 IDE大家, 而我也因為 Android 開發所以使用得都順手。 起初我是偏好 Android Studio, 理由是 一個 IDE 開發兩種 Code 是比較想要的, 而 Android 放棄 Eclipse 完全移植到 IntelliJ 來了。但最後沒有選擇 Android Studio 是因為,Android Studio 的 Go Plugin 有版本問題 ,最新支援到 Go 1.4 。 這並不理想,意味著 Go 的升級會受限 IDE。最後我選擇了 Eclipse,一來 Eclipse GoClipse plug-in 並不受 Go 版本限制,二來 Eclipse 是有支援 Go 實驗性質的 Debug  Support! 最後,Eclipse 的 User Interface 對我來說比較有親和力。


這邊有一篇比較各種 IDE的 文章很不錯!
http://geekmonkey.org/2012/09/comparison-of-ides-for-google-go/


Summary :
  • Sublime 3  : 理想且強大的文字編輯器。 Go Plugin Support 使用起來順暢,但最終他是個文字編輯器。
  • Atom :  github 出的文字編輯器,有令喜愛的 md file preview 功能。 Go-Plus Plugin 包含許多 go tools : gocode, gofmt, goimport, gofmt, govet, golint, go build ... 
  • IntelliJ :  高階語言的開發者介面模式。可以跟 Android 整合再一起。Plug-in 是 Go version depended。最新支援到 Go 1.4 (Feb. 2016)
  • Eclipse:  高階語言的開發者介面模式。是個受歡迎的 IDE支援非常多的語言。 GoClipse Plugin 並非 Go Version Depended,支援 Experimental Debug Support! 好用的使用者介面。 

2015年10月8日 星期四

[Go]Go 1.5 Release 重點整理

Go 1.5 是一個非常大的改進,最重要的幾點是 GC 的改變以及 gomobile 的支援。 Go 的 GC 一直以來就被說低效能,而 GC 是多麼重要的一件事情。 Gomobile 則是正式支援了 android 與 ios App,開啟了 Go 的 mobile 時代。

根據 Go Blog Go 1.5 的重點如下 :
  • Implementation:
    • Compiler Tool Chain 從 C 變成 Go
    • Garbage Collection 從新設計改善 GC pause time
    • GOMAXPROCS Default 由 1 變成 logical CPU 數目
    • Go Linker 更改可以 build archieve or shared library 讓 C 使用

  • Tools
    • internal package (只有某些鄰近package 可以使用) : 實驗性質的 Vendoring Packages
    • 新的 go tool trace : program trace 的視覺化工具
    • 新的 go doc : 新的 command line

  • Operation system & architecture
    • 較成熟的 darwin/arm, darwin/arm64 (Apple's iPhone and iPad devices), and linux/arm6 架構 (darwin/arm64 用在  gomobile)
    • 實驗性質的ppc64 and ppc64le (IBM 64-bit PowerPC, big and little endian)
  • Language
    • 幾乎沒有 很細微的 Map , 的 element type 省略支援
  • Standard Libray
    • 比較簡潔的 usage message
    • math/big package 支援 Float type
    • DNS resolver on Linux and BSD : 不用 cgo requirement
    • go/type 被移到 standard library 了
    • reflect library 增加ArrayOf & FuncOf Function
    • 其他小改


Reference:
Go 1.5 Release Note

2015年9月24日 星期四

[Golang]Build go library for Android using gomobile step by step

Build go library for Android using gomobile step by step

1. Supposed  \src\gobindtemp  is my go lib source file

2. Build arr file

gomobile bind [directory under gopath]
ie.  gomobile bind -target=android gobindtemp

generate an aar file  ie. gobindtemp.aar

I suggest go to the project directory use 

gomobile bind -target=android

this will generate .aar file in the project directory

otherwise , .aar is generate in the same directory with /src

2015年9月21日 星期一

[Golang]GoMobile的安裝與建置 (Android)

有個風傳是如無法支援 Mobile ,那麼這個語言的前景有限。 Go 一直有被這風傳掃到,雖然之前還是有方法可給 mobile 使用,不過 Go 開發Team的人自己吐槽說很難用,搞了半天心都死了。 可喜可賀的是,Go  在 1.5 正是支援了 跨平台的到 Mobile 的工具叫 gomobile! 這消息並沒有在 google io 發佈,所以好像也沒有啥麼 Big Deal。但我覺得這是Go 即將要崛起的一個重要序曲。 Go 不但能寫後端 還可以跨到 Mobile , 甚至可以獨立完全開發 Android APK 真是太棒! 當然很多語言都可以,但很多語言就沒 Go 這麼簡單美麗而強大呀呀呀!

GoMobile Installation and Building

Command gomobile
gomobile 是用來build & run 用go 寫的 app 。 Go 語言版本需要 1.5 以上。

Go Mobile GitHub
gomobile 的 github 有比較詳盡的介紹

GoDoc for gomobile
gomobile package 的文件

Go Mobile ReadMe Note:  

根據 Gomobile github 上 ReadMe 的筆記跟做心得

Go Mobile Tool:
Go Mobile 提供兩個方法,一個是全部用 Go build 的 App , 一個是 build 成 SDK給 Java/Android/ios 使用