Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ExampleStringer (4.16 sec)

  1. src/runtime/testdata/testprog/crash.go

    func DoubleErrorPanic() {
    	panic(examplePanicError{})
    }
    
    type exampleStringer struct{}
    
    func (s exampleStringer) String() string {
    	panic("important multi-line\nstringer message")
    }
    
    func StringerPanic() {
    	panic(exampleStringer{})
    }
    
    type examplePanicStringer struct{}
    
    func (s examplePanicStringer) String() string {
    	panic(exampleStringer{})
    }
    
    func DoubleStringerPanic() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 19:10:41 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  2. src/fmt/stringer_example_test.go

    type Animal struct {
    	Name string
    	Age  uint
    }
    
    // String makes Animal satisfy the Stringer interface.
    func (a Animal) String() string {
    	return fmt.Sprintf("%v (%d)", a.Name, a.Age)
    }
    
    func ExampleStringer() {
    	a := Animal{
    		Name: "Gopher",
    		Age:  2,
    	}
    	fmt.Println(a)
    	// Output: Gopher (2)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 30 19:40:13 UTC 2018
    - 551 bytes
    - Viewed (0)
Back to top