lancet: A powerful utils function lib of go

1. What is lancet?

Lancet is a comprehensive, efficient, and reusable util function library of Go. It’s been a year since lancet was released and now it supports more and more features. which makes go development more efficient. In this tutorial, you will have an overview of lancet.

For more details. please see lancet repository.

2. What can lancet do?

In daily development, we will collect some common code logic into util functions. but different projects sometimes have the same utility function, which will cause bad code smell. That’s what lancet try to solve. With lancet, you don’t have to write lots of same util functions. Because there are more than 300 util functions in lancet.

3. How to use lancet?

Lancet organizes the code into package structure, you need to import the corresponding package name when use it. For example, if you use string-related functions, import the strutil package like below:

import "github.com/duke-git/lancet/v2/strutil"

Here takes the string function Reverse (reverse order string) as an example, the strutil package needs to be imported.

package main

import (

    "fmt"

    "github.com/duke-git/lancet/v2/strutil"

)

func main() {

    s := "hello"

    rs := strutil.Reverse(s)

    fmt.Println(rs) //olleh

}

4. How much feature lancet support?

Lancet has extensive support for Go development. Eg. algorithm, concurrency, convert, crypto, datetime, file, slice, math, net, string, system… You can explore it via lancet repository.

5. How to contribute code?

I really appreciate any code commits which make lancet powerful. Please follow the steps below to create your pull request.

  • Fork the repository.
  • Create your feature branch.
  • Commit your changes.
  • Push to the branch
  • Create new pull request.
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.