github.com/searKing/golang/go@v1.2.117/error/multi/example_test.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package multi_test 6 7 import ( 8 "fmt" 9 10 "github.com/searKing/golang/go/error/multi" 11 ) 12 13 func ExampleNew() { 14 err := multi.New(fmt.Errorf("whoops"), fmt.Errorf("foo")) 15 fmt.Println(err) 16 17 // Output: whoops|foo 18 } 19 20 func ExampleFormat() { 21 err := multi.New(fmt.Errorf("whoops"), fmt.Errorf("foo")) 22 fmt.Printf("%+v", err) 23 24 // Output: 25 // Multiple errors occurred: 26 // whoops|foo 27 }