🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

github.com/cilium/fake

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/cilium/fake

v0.7.0
Source
Go
Version published
Created
Source

fake - generate random data for testing and/or performance evaluation

Go Reference CI Go Report Card

Fake is a Go library and CLI to generate random data such as names, adjectives, IP addresses and so on.

This repository contains three Go modules:

As opposed to most fake data generator Go libraries, a design philosophy of this library is to allow fine-grained control over generated data.

Let's illustrate this with an example. Instead of having separate functions to generate IPv4 and IPv6 addresses (e.g. fake.IPv4() and fake.IPv6()), there is a single fake.IP() function. However, this generator function, like most others, can take optional arguments. By default, i.e. when no option is specified (fake.IP()), it generates a random IP address which can be either v4 or v6. However, when passing the option to generate IPv4 addresses only (fake.IP(fake.WithIPv4()) option, only v4 addresses are generated. It is also possible to pass an option to specify a CIDR that randomly generated IP addresses must belong to (e.g. fake.IP(fake.WithIPCIDR("10.0.0.0/8"))).

Compared to other fake data generator Go libraries such as github.com/icrowley/fake or github.com/bxcodec/faker, this library does not (yet) support as many generators (contributions welcome!).

Installing the CLI

Go needs to be installed. Then, from either the root directory or the cmd subdirectory, the fake binary can be compiled and installed via the install make target. E.g.

make install

By default, it installs the binary to /usr/local/bin/fake. The destination directory can be specified using the BINDIR environment variable, e.g.:

BINDIR=~/.local/bin make install

FAQs

Package last updated on 28 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts