docs/go-cheatsheet.md

507 B

go (golang) cheatsheet

testing

use testify

import "github.com/stretchr/testify/assert"


func TestSomething(t *testing.T) {
	a := assert.New(t)

    thing, err := functionCall()
    
	t.Logf("%#v", thing)

	a.NotNil(err)
}

use %#v

t.Logf("%#v", eim)

Outputs types with keys, viz:

    inner_test.go:17: &message.InnerMessage{
        ours:(*message.InnerJSONStruct)(nil),
        dstPubKey:(*cbk.CryptoBoxKey)(nil),
        srcPrivKey:(*cbk.CryptoBoxKey)(nil)}