commit bfc7d0eb8c7f66b910fc5d0ab482ca3e9b4f7d38
parent cf9a966edf23ef7fa8c9ecc5545e4120a8bafa7a
Author: hhvn <dev@hhvn.uk>
Date: Sat, 17 Feb 2024 18:02:17 +0000
Rename example so it actually counts as one
Diffstat:
2 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/example_test.go b/example_test.go
@@ -0,0 +1,32 @@
+package superstruct
+
+import (
+ _ "testing"
+ "fmt"
+)
+
+type first struct {
+ A string
+ C string
+}
+
+type second struct {
+ B string
+ C string
+}
+
+
+func Example() {
+ a := first{"a", "c"}
+ b := second{"b", "d"}
+ c, err := CreateAndCopy(a, b)
+ if err != nil {
+ return
+ }
+
+ fmt.Println(SortedStructString(c))
+ // Output:
+ // A: a
+ // B: b
+ // C: d
+}
diff --git a/superstruct_example.go b/superstruct_example.go
@@ -1,31 +0,0 @@
-package superstruct
-
-import (
- "fmt"
-)
-
-type first struct {
- A string
- C string
-}
-
-type second struct {
- B string
- C string
-}
-
-
-func ExampleCreateAndCopy() {
- a := first{"a", "c"}
- b := second{"b", "d"}
- c, err := CreateAndCopy(a, b)
- if err != nil {
- return
- }
-
- fmt.Println(SortedStructString(c))
- // Output:
- // A: a
- // B: b
- // C: d
-}