2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

faker ダミーデータ生成ライブラリ Go

Last updated at Posted at 2021-02-12

人名や住所などのダミーデータをランダムに生成するGoライブラリ。英語ですが。

faker

package main

import (
	"fmt"

	"github.com/jaswdr/faker"
)

func main() {
	faker := faker.New()

	fmt.Println(faker.Person().Name())

	fmt.Println(faker.Address().Address())

	fmt.Println(faker.Lorem().Text(100))
}

ループで使用する場合。

	p := faker.Person()

	for i := 0; i < 10; i++ {
		fmt.Println(p.Name())
	}

実行結果

Ms. Kaitlin Johnston II
7 Balistreri Crossing Apt. 728
Loychester, DE 29058
aliasconsequaturautperferendissitvoluptatemaccusantiumdoloremqueaperiameaqueipsaquaeabilloinventore
Mr. Merlin Donnelly
Ilene Douglas
Dedric Kautzer
Waldo Schinner
Mr. Milan Kling Jr.
Emie Kling
Craig Kulas
Alivia Strosin
Ms. Fannie Raynor III
Ms. Macie Sanford Jr.
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?