From 8ef40f53f2143da8afcca05b5243ef21c525b620 Mon Sep 17 00:00:00 2001 From: Edward Date: Wed, 27 May 2020 21:53:18 +0800 Subject: [PATCH] merge singleton pattern --- README.md | 4 ++-- .../singleton}/singleton/internal/singleton.go | 0 {playground => creational/singleton}/singleton/main.go | 0 profiling/profile.go | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) rename {playground => creational/singleton}/singleton/internal/singleton.go (100%) rename {playground => creational/singleton}/singleton/main.go (100%) diff --git a/README.md b/README.md index 9ec43e7..f49575b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A curated collection of idiomatic design & application patterns for Go language. -#### a fork of [tmrts/go-patterns](https://github.com/tmrts/go-patterns) but merged in with other awesome forks. can go with [patterns-in-examples](https://github.com/crazybber/go-fucking-patterns) +#### a fork of [tmrts/go-patterns](https://github.com/tmrts/go-patterns) but merged in with other awesome forks. can go with [patterns-in-examples](https://github.com/crazybber/go-pattern-examples) ## Merged Repos @@ -123,4 +123,4 @@ A curated collection of idiomatic design & application patterns for Go language. ## A pattern implementation -[go-patterns-in-examples](https://github.com/crazybber/go-fucking-patterns) +[go-patterns-in-examples](https://github.com/crazybber/go-pattern-examples) diff --git a/playground/singleton/internal/singleton.go b/creational/singleton/singleton/internal/singleton.go similarity index 100% rename from playground/singleton/internal/singleton.go rename to creational/singleton/singleton/internal/singleton.go diff --git a/playground/singleton/main.go b/creational/singleton/singleton/main.go similarity index 100% rename from playground/singleton/main.go rename to creational/singleton/singleton/main.go diff --git a/profiling/profile.go b/profiling/profile.go index 7b615c6..d0ad946 100644 --- a/profiling/profile.go +++ b/profiling/profile.go @@ -18,8 +18,8 @@ func BigIntFactorial(x big.Int) *big.Int { defer Duration(time.Now(), "IntFactorial") y := big.NewInt(1) - for one := big.NewInt(1); x.Sign() > 0; x.Sub(x, one) { - y.Mul(y, x) + for one := big.NewInt(1); x.Sign() > 0; x.Sub(&x, one) { + y.Mul(y, &x) } return x.Set(y)