From bee840cece0b75e162ab1b5a7c5cfc6c28c0ff4f Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 4 Jan 2022 17:11:51 +0100 Subject: [PATCH] remove id.go --- common.go | 9 +++++++++ id_test.go => common_test.go | 0 id.go | 14 -------------- 3 files changed, 9 insertions(+), 14 deletions(-) rename id_test.go => common_test.go (100%) delete mode 100644 id.go diff --git a/common.go b/common.go index 2c06713d..f041c8df 100644 --- a/common.go +++ b/common.go @@ -24,6 +24,7 @@ package span import ( + "encoding/base64" "fmt" ) @@ -45,3 +46,11 @@ type Skip struct { func (s Skip) Error() string { return fmt.Sprintf("[skip] %s", s.Reason) } + +// GenFincID returns a finc.id string consisting of an arbitraty prefix (e.g. +// "ai"), source id and URL safe record id. No additional checks, sid and rid +// should not be empty. +func GenFincID(sid, rid string) string { + return fmt.Sprintf("ai-%s-%s", sid, + base64.RawURLEncoding.EncodeToString([]byte(rid))) +} diff --git a/id_test.go b/common_test.go similarity index 100% rename from id_test.go rename to common_test.go diff --git a/id.go b/id.go deleted file mode 100644 index 285be663..00000000 --- a/id.go +++ /dev/null @@ -1,14 +0,0 @@ -package span - -import ( - "encoding/base64" - "fmt" -) - -// GenFincID returns a finc.id string consisting of an arbitraty prefix (e.g. -// "ai"), source id and URL safe record id. No additional checks, sid and rid -// should not be empty. -func GenFincID(sid, rid string) string { - return fmt.Sprintf("ai-%s-%s", sid, - base64.RawURLEncoding.EncodeToString([]byte(rid))) -}