GO

Deploy a Go Project to Docker hub by Github Action

In this article, we will create a simple golang application CI/CD process and push it to Docker hub by github action. Finally, will illustrate an example of how to use the terraform and docker-compose to deploy a local docker environment.

Continue Reading

Golang: Gin + Gorilla to build a websocket application

Here we used the gorilla module to build a websocket application, and this tutorial will focus on building up a websoccket server. About client part will implement with the chrome extension: Websocket King.

Continue Reading

Golang: 解決 Go Websocket upgrade:websocket: request origin not allowed by Upgrader.CheckOrigin 跨域問題

Golang: 解決 Go Websocket upgrade:websocket: request origin not allowed by Upgrader.CheckOrigin 跨域問題 錯誤訊息: upgrade:websocket: request origin not allowed by Upgrader.CheckOrigin 原因: 如內文所述,在 Go Websocket 判別跨域來源不合法 解決方式: 需要在 websocket.Upgrader 設定 CheckOrigin 來源,例如下方允許所有來源

Continue Reading

Golang - Using Cobra to build your CLI Application

Cobra is a golang library for creating CLI applications and is using by Kubernetes, Hugo, and Github CLI..

Here we will show how to use cobra to build a CLI app.

Continue Reading

Golang - Get Global Environment Variable From Bash Profile (~/.bash_profile)

In golang project, we may need to call os environment variable for security purposes in OSX or Linux.

Here will showing how to set global environment and get value in our golang project.

Continue Reading

Golang Tutorial : Introduction Gin HTML template and how integration with bootstrap

Introduction Gin HTML template and how integration with bootstrap

Gin is going web framework which include server-side render template, we can transfer variable into a template and render by double braces {{ … }}.

In this article, We will introduce how to use gin template, finally will include how to integrate bootstrap with gin HTML template.

Continue Reading

Gin - Middleware (中間件) 程式運作原理及用法教學

Gin - Middleware (中間件) 程式運作原理及用法教學

Gin - Middleware (中間件) 程式運作原理及用法教學

在 Web 應用及開發中,一個完整的請求會包含客戶端請求,伺服器端接收及處理,返回內容給結果。

在真實的場景中,在這些流程還會有更複雜的功能,例如:權限管理,安全驗證及日誌等部分,因此在開發過程我們常要思考,如何更好的管理這些通用的功能,以套件的方式來進行開發,就可以很方便地進行對接及配置。

Continue Reading

GoLang - grpc enum 定義預設類型

GoLang - grpc enum 定義預設類型

在設計 grpc 時,如果我們產品需要分區,不同區域會有不同的產品,該如何處理?

本篇預設讀者對於 grpc 有一定的瞭解,以下將簡單舉例,先說明查單一商品,以及修改為回傳多商品,最後則是 server 與 client 端如何處理這部分的流程:

Continue Reading

GoLang - grpc 使用 Repeated 回傳多筆數據

grpc tutorial 教學

GoLang - grpc 使用 Repeated 回傳多筆數據

在設計 grpc 時,如果我們需要取得商品列表,該如何獲得?

本篇預設讀者對於 grpc 有一定的瞭解,以下將簡單舉例,先說明查單一商品,以及修改為回傳多商品,最後則是 server 與 client 端如何處理這部分的流程:

Continue Reading

Go Module與 Go get 常用參數說明

Golang - 教學 tutorial

Go Module與 Go get 常用參數說明

在 Go 語言結構,可以透過 import

Continue Reading

GoLang - catch panic 避免主系統錯誤

Golang - 教學 tutorial

GoLang - catch panic 避免主系統錯誤

在這幾篇,會以 Go 語言的入門基礎進行逐步說明,本篇針對 catch panic 進行說明

Continue Reading

GoLang - select 監聽多 channel 及設定逾時

Golang - 教學 tutorial

GoLang - select 監聽多 channel 及設定逾時策略

在這幾篇,會以 Go 語言的入門基礎進行逐步說明,本篇針對 多Project Layou 進行說明

Continue Reading

GoLang - 多 goroutine 透過 Channels 協同處理範例

GoLang - 多 goroutine 透過 Channels 協同處理範例

在這幾篇,會以 Go 語言的入門基礎進行逐步說明,本篇針對 多 goroutine 透過 channel 協同處理 進行說明

Continue Reading

GoLang - 多線程全局變數加鎖

Golang - 教學 tutorial

GoLang - 多線程全局變數加鎖

在這幾篇,會以 Go 語言的入門基礎進行逐步說明,本篇針對 多線程全局變數加鎖 進行說明

Continue Reading

GoLang - Channels (上) Buffered / UnBuffered

Golang - 教學 tutorial

GoLang - Channels

在這幾篇,會以 Go 語言的入門基礎進行逐步說明,本篇針對 Channel 進行說明

Continue Reading

GoLang - grpc

GoLang - grpc

在本篇會透過一個簡單的範例,建立一個簡單的 grpc程序, 在開始前,先確認安裝了protocol buffer compiler

接著,開始說明如何建構基本的 grpc 架構:

Continue Reading

Mac, Linux, Windows 安裝 Protocol Buffer (protobuf) compiler 方式

Mac, Linux, Windows 安裝 Protocol Buffer (protobuf) compiler 方式

在 gRPC 經常會使用到 Protocol buffer 來定義 SERVICE或者進行序列化(serialization) 處理,這裡說明如何在各平台安裝 Protocol buffer compiler :

Continue Reading

GoLang - 如何等待多個 goroutine 非同步 (async) 返回結果

Golang - 教學 tutorial

GoLang - 如何等待多個 goroutine 非同步 (async) 返回結果

在這幾篇,會以 Go 語言的入門基礎進行逐步說明,本篇針對 goroutine 進行說明

Continue Reading

GoLang - Goroutine (上) 基本原理與結構

GoLang - Goroutine (上) 基本原理與結構

在這幾篇,會以 Go 語言的入門基礎進行逐步說明,本篇針對 goroutine 進行說明

Continue Reading

GoLang - Reflect 反射

Golang - 教學 tutorial

GoLang - Reflect 反射

在這幾篇,會以 Go 語言的入門基礎進行逐步說明,本篇針對 reflect 進行說明

Continue Reading