Go Language Notes

Go Language Notes

Notes on Go Language

Install go Lang on Ubuntu : https://github.com/golang/go/wiki/Ubuntu

If you’re using Ubuntu 16.04 LTS and are unable to install golang-1.10-go, then you can also use the longsleep/golang-backports PPA:

sudo add-apt-repository ppa:longsleep/golang-backports

sudo apt-get update

sudo apt-get install golang-go

root@BlockChainHLF:~/work/hlf/fabric-samples# go version

go version go1.10.1 linux/amd64

Defining time. Time in Go : 

t := time.Now()
DateTime:  &t,

Building first chain code 

/work/hlf/fabric-samples/chaincode/chaincode_example02/go# go build

# github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11

../../../go/src/github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11/pkcs11.go:26:18: fatal error: ltdl.h: No such file or directory

compilation terminated.

To Solve this install : 

[libltdl-dev – A system independent dlopen wrapper for GNU libtool]

/hlf/fabric-samples/chaincode/chaincode_example02/go# sudo apt install libltdl-dev

Reading package lists… Done

Building dependency tree       

/work/hlf/fabric-samples/chaincode/chaincode_example02/go# go build

/work/hlf/fabric-samples/chaincode/chaincode_example02/go# ls -l

total 14840

-rw-r–r– 1 root root     5436 Apr 21 00:11 chaincode_example02.go

-rwxr-xr-x 1 root root 15184528 Apr 22 08:26 go

Create Struct from JSON


Also refer more on Json


Regular Expression in go


One thought on “Go Language Notes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s