category: golang

golang - note

on 2019-09-03

golang - note log

時間格式的雷

2006-01-02 15:04:05

https://golang.org/pkg/time/#Time.Format

Golang 时间格式化的奇怪设定 —— 为什么你一直出错

Array

Array

確認 type

import "reflect"

x := 7

reflect.TypeOf(x).Kind();

Convert interface to string

var x interface{} = "abc"
str := fmt.Sprintf("%v", x)
fmt.Printf("%+v\n", struct)

Golang - gvm Golang version manger

on 2019-06-14

gvm

Intro

gvm

Golang version manger

Usage

  1. Install
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
  1. Add to .bashrc or .zshrc
# added gvm command to shell
source "$HOME/.gvm/scripts/gvm"
# directory path for GO
export GOPATH=$HOME/gopath
export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin
  1. Install go
gvm install go1.4 -B
gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT
gvm install go1.9
  1. Finall add command to .bashrc or .zshrc
gvm use go1.9

Refer - Go - 在 OSX 安裝 GVM

Read more