Repolode
duke-git

duke-git/lancet

A Go utility library of 700+ reusable helper functions for strings, slices, datetime, networking, cryptography and more, inspired by lodash.

Stars
5,300
Forks
518
Open issues
11
Last commit
9 hours ago

What is it?

Lancet is a Go utility function library covering common needs such as string manipulation, slice and map operations, datetime handling, networking, and cryptography. It is inspired by Java's Apache Commons and lodash.js, and aims to give Go developers a reusable set of helpers so they don't have to rewrite them in every project.

Version 2.x is built on Go generics and requires Go 1.18 or later. The v1.x line remains available for older Go versions. The library depends only on the Go standard library and golang.org/x packages, and every exported function ships with unit tests.

Functions are organized into packages such as strutil, slice, datetime, cryptor, convertor and concurrency, and each package is imported separately, so you only pull in what you use.

Key features

  • 01Provides 700+ utility functions across strings, slices, datetime, net, crypto and more.
  • 02Uses Go generics in v2.x for type-safe helpers.
  • 03Depends only on the Go standard library and golang.org/x.
  • 04Every exported function has unit tests.
  • 05Organized into separate packages so you import only what you need.

Use cases

  • Replacing hand-written string, slice or map helpers in Go services.
  • Adding date arithmetic or safe month/year addition to a Go project.
  • Using common cryptographic helpers such as AES, RSA, HMAC and SM-series algorithms.
  • Simplifying concurrency patterns like fan-in, channel pipelines and keyed locks.

Quick start

  1. 1

    Install the v2 module with go get

    go get github.com/duke-git/lancet/v2
  2. 2

    Import the package you need, for example strutil

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

Things to know

  • Go 1.18 or newer is required for v2; older Go versions need the v1 line.

Topics

FAQ

What is lancet?
A Go utility library of 700+ reusable helper functions for strings, slices, datetime, networking, cryptography and more, inspired by lodash. Lancet is a Go utility function library covering common needs such as string manipulation, slice and map operations, datetime handling, networking, and cryptography. It is inspired by Java's Apache Commons and lodash.js, and aims to give Go developers a reusable set of helpers so they don't have to rewrite them in every project.
Is lancet free to use? What license does it have?
lancet is open source under the MIT license. Check the license terms before using it in commercial products.
Is lancet still maintained?
Actively maintained. The last commit to lancet was on Oct 24, 2026.
What can I use lancet for?
Replacing hand-written string, slice or map helpers in Go services. Adding date arithmetic or safe month/year addition to a Go project. Using common cryptographic helpers such as AES, RSA, HMAC and SM-series algorithms. Simplifying concurrency patterns like fan-in, channel pipelines and keyed locks.
How do I install lancet?
Install the v2 module with go get: go get github.com/duke-git/lancet/v2 Import the package you need, for example strutil: import "github.com/duke-git/lancet/v2/strutil"
Where can I get lancet?
The source code and installation instructions are on GitHub: https://github.com/duke-git/lancet

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects