GO

Docker build go image

Docker build go image

這裡記錄一下簡易的 Go build image 流程

Continue Reading

Golang - Gin router 基本介紹

Go - Gin router 基本介紹

這裡針對 Gin routers 進行基本介紹,後續會針對個部分進行探討。

Gin 基本的一個架構如下方代碼:

Continue Reading

Golang - Go Module 套件管理 & 初始化及安裝 gin

Go - go module 初始化及安裝 gin

Gin 是一個 Golang 網頁架構,具有相當好的效能,高於 httprouter 40 倍的速度,是一個兼具效能與實用的架構。

這裡首先會針對 go module 初始化 如何透過 Go Module 管理套件,以及說明如何透過 Go Module 安裝 gin 的流程。

Continue Reading

在 CentOS7 安裝 Protocol Buffer

這裡記錄在 CentOS7 安裝 Protocol Buffer 流程 sudo yum install autoconf automake libtool unzip gcc-c++ -y git clone https://github.com/google/protobuf.git cd protobuf ./autogen.sh ./configure make make install protoc --version

Continue Reading

Golang 技術方向紀錄

簡記一些學習 Go 的技術方向 Web Framework Gin https://github.com/gin-gonic/gin Echo https://echo.labstack.com/guide BeeGo https://beego.me/ Gin Websocket https://github.com/gin-gonic/gin/issues/1305 example: https://github.com/gin-gonic/gin/issues/1305 go module 類似 php vender 動套件管理工具: 透過 go mod init 會產生 go.mod Drone CI/CD 透過 Drone 來實現 Go CI/CD https://drone.

Continue Reading

Golang 入門教學 tutorial

Golang - 語言基礎 Slice

Golang 入門教學 tutorial

Go 是現代化、速度相當快且擁有豐富的標準庫 透過 goroutine 併發非常有效率,單一線程可以執行多個 goroutine。 在設計併發架構最困難的部分在於如何確保多個併發進程、線程及groutine 不會同時針對同一資料進行操作。透過 Go 可以簡單地實現併發過程數據一致性。 Go 提倡組合(composition),而不是傳統繼承方式;因此,可直接多個類型組合成類型,並且引用這個類型就能使用整個組合的功能。 Go 在內存管理也處理得相當好,使用現代化的回收機制。

Continue Reading

Go - Hello world

首先,建立第一個 Hello world

建立資料夾 hello-go/

mkdir hello-go

cd hello-go

Continue Reading

Go - CentOS 安裝 golang

這裡指令皆使用 root 身分執行,若其他身分請使用 sudo

安裝環境為 CentOS 7 以上版本

這裡會介紹兩種安裝方式,第一種較為簡單,是直接透過 yum 安裝,另一種方式是直接下載安裝(推薦)

方法一、直接使用 yum 安裝

yum 安裝方式

# yum install golang

Continue Reading