1.优化uuid公共模块

2.程序启动错误检测
This commit is contained in:
boyce
2019-03-15 17:12:03 +08:00
parent 94512a6bb6
commit 91bb7d7833
3 changed files with 22 additions and 3 deletions

View File

@@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package util
package uuid
import (
crand "crypto/rand"
@@ -44,6 +44,16 @@ func (this UUID) Hex() string {
}
func (this UUID) HexEx() string {
x := [16]byte(this)
return fmt.Sprintf("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
x[0], x[1], x[2], x[3], x[4],
x[5], x[6],
x[7], x[8],
x[9], x[10], x[11], x[12], x[13], x[14], x[15])
}
// Rand generates a new version 4 UUID.
func Rand() UUID {
var x [16]byte