Skip to content

Latest commit

 

History

History
55 lines (45 loc) · 1.01 KB

README.md

File metadata and controls

55 lines (45 loc) · 1.01 KB

awesome libs

  • cipher
  • error: print and trace
  • reflect: some useful reflect gadgets
  • slice
    • func In(item interface{}, slice interface{}) bool
  • python like format

error

use awesome_libs/log.Logger as Logger

import "github.com/ssst0n3/awesome_libs/awesome_error"

func example()  {
    awesome_error.CheckError(errors.New("test"))
}

use self-defined logger

import (
	"errors"
	"github.com/ssst0n3/awesome_libs/log/logger"
	"os"
)

func example() {
	a := GetAwesomeError(logger.InitLogger("my-logger", os.Stdout), true)
	a.CheckErr(errors.New("apple"))
}

cipher

There's a CommonCipher already inited for you. It's key read from SecretDir/awesome_libs_cipher_common.

import "github.com/ssst0n3/awesome_libs/cipher"

func any()  {
    ...
    enc, err := cipher.CommonCipher.Encrypt(pt)
}

python like format

import "github.com/ssst0n3/awesome_libs"

func Format()  {
	awesome_libs.Format("Hello {.name}", awesome_libs.Dict{
		"name": "awesome",
	})
}