Merge pull request #35 from OrlovEvgeny/master
edit slice
diff --git a/README.md b/README.md
index 21205ea..9d92c11 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,3 @@
-**This package is currently in development and the API may not be stable.**
-
-The API will become stable with v1.
-
# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master)
The uuid package generates and inspects UUIDs based on
[RFC 4122](http://tools.ietf.org/html/rfc4122)
diff --git a/marshal.go b/marshal.go
index 84bbc58..7f9e0c6 100644
--- a/marshal.go
+++ b/marshal.go
@@ -15,8 +15,6 @@
// UnmarshalText implements encoding.TextUnmarshaler.
func (uuid *UUID) UnmarshalText(data []byte) error {
- // See comment in ParseBytes why we do this.
- // id, err := ParseBytes(data)
id, err := ParseBytes(data)
if err == nil {
*uuid = id
diff --git a/node.go b/node.go
index 384f07d..3e4e90d 100644
--- a/node.go
+++ b/node.go
@@ -37,7 +37,6 @@
}
func setNodeInterface(name string) bool {
-
iname, addr := getHardwareInterface(name) // null implementation for js
if iname != "" && addr != nil {
ifname = iname
diff --git a/uuid.go b/uuid.go
index 68f7b25..920dadf 100644
--- a/uuid.go
+++ b/uuid.go
@@ -97,6 +97,16 @@
return uuid, nil
}
+// MustParse is like Parse but panics if the string cannot be parsed.
+// It simplifies safe initialization of global variables holding compiled UUIDs.
+func MustParse(s string) UUID {
+ uuid, err := Parse(s)
+ if err != nil {
+ panic(`uuid: Parse(` + s + `): ` + err.Error())
+ }
+ return uuid
+}
+
// FromBytes creates a new UUID from a byte slice. Returns an error if the slice
// does not have a length of 16. The bytes are copied from the slice.
func FromBytes(b []byte) (uuid UUID, err error) {