Search Options

Results per page
Sort
Preferred Languages
Advance

Results 71 - 80 of 1,938 for panics (0.11 sec)

  1. src/reflect/swapper.go

    // slice.
    //
    // Swapper panics if the provided interface is not a slice.
    func Swapper(slice any) func(i, j int) {
    	v := ValueOf(slice)
    	if v.Kind() != Slice {
    		panic(&ValueError{Method: "Swapper", Kind: v.Kind()})
    	}
    	// Fast path for slices of size 0 and 1. Nothing to swap.
    	switch v.Len() {
    	case 0:
    		return func(i, j int) { panic("reflect: slice index out of range") }
    	case 1:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:30 UTC 2024
    - 2K bytes
    - Viewed (0)
  2. pkg/config/schema/collection/schema.go

    	}
    
    	return &schemaImpl{
    		variableName: b.VariableName,
    		resource:     b.Resource,
    	}, nil
    }
    
    // MustBuild calls Build and panics if it fails.
    func (b Builder) MustBuild() Schema {
    	s, err := b.Build()
    	if err != nil {
    		panic(fmt.Sprintf("MustBuild: %v", err))
    	}
    
    	return s
    }
    
    type schemaImpl struct {
    	resource     resource.Schema
    	name         config.GroupVersionKind
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Mar 01 01:34:15 UTC 2023
    - 2.3K bytes
    - Viewed (0)
  3. src/internal/runtime/exithook/hooks.go

    func Add(h Hook) {
    	for !locked.CompareAndSwap(0, 1) {
    		Gosched()
    	}
    	hooks = append(hooks, h)
    	locked.Store(0)
    }
    
    // Run runs the exit hooks.
    //
    // If an exit hook panics, Run will throw with the panic on the stack.
    // If an exit hook invokes exit in the same goroutine, the goroutine will throw.
    // If an exit hook invokes exit in another goroutine, that exit will block.
    func Run(code int) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 16:41:13 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  4. test/recover1.go

    	defer mustNotRecover()
    	defer func() {
    		recover()
    		defer mustRecover(3)
    		panic(3)
    	}()
    	panic(2)
    }
    
    func test4() {
    	// Single panic.
    	defer mustNotRecover()
    	defer func() {
    		recover()
    	}()
    	panic(4)
    }
    
    func test5() {
    	// Single panic but recover called via defer
    	defer mustNotRecover()
    	defer func() {
    		defer recover()
    	}()
    	panic(5)
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 2.5K bytes
    - Viewed (0)
  5. src/cmd/link/internal/ld/util.go

    	fmt.Fprintf(os.Stderr, os.Args[0]+": "+format+"\n", a...)
    	nerrors++
    	if *flagH {
    		panic("error")
    	}
    	Exit(2)
    }
    
    // afterErrorAction updates 'nerrors' on error and invokes exit or
    // panics in the proper circumstances.
    func afterErrorAction() {
    	nerrors++
    	if *flagH {
    		panic("error")
    	}
    	if nerrors > 20 {
    		Exitf("too many errors")
    	}
    }
    
    // Errorf logs an error message.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 22 20:39:11 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  6. src/go/ast/print.go

    // localError wraps locally caught errors so we can distinguish
    // them from genuine panics which we don't want to return as errors.
    type localError struct {
    	err error
    }
    
    // printf is a convenience wrapper that takes care of print errors.
    func (p *printer) printf(format string, args ...any) {
    	if _, err := fmt.Fprintf(p, format, args...); err != nil {
    		panic(localError{err})
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  7. src/runtime/lfstack.go

    		if atomic.Cas64((*uint64)(head), old, next) {
    			return unsafe.Pointer(node)
    		}
    	}
    }
    
    func (head *lfstack) empty() bool {
    	return atomic.Load64((*uint64)(head)) == 0
    }
    
    // lfnodeValidate panics if node is not a valid address for use with
    // lfstack.push. This only needs to be called when node is allocated.
    func lfnodeValidate(node *lfnode) {
    	if base, _, _ := findObject(uintptr(unsafe.Pointer(node)), 0, 0); base != 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 2K bytes
    - Viewed (0)
  8. test/fixedbugs/issue22881.go

    // The RHS panics in all of these cases.
    
    package main
    
    import "fmt"
    
    func main() {
    	for i, f := range []func(map[int]int){
    		f0, f1, f2, f3, f4, f5, f6, f7, f8,
    	} {
    		m := map[int]int{}
    		func() { // wrapper to scope the defer.
    			defer func() {
    				recover()
    			}()
    			f(m) // Will panic. Shouldn't modify m.
    			fmt.Printf("RHS didn't panic, case f%d\n", i)
    		}()
    		if len(m) != 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 20 01:47:07 UTC 2018
    - 2K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned/typed/cr/v1/cr_client.go

    		return nil, err
    	}
    	return &CrV1Client{client}, nil
    }
    
    // NewForConfigOrDie creates a new CrV1Client for the given config and
    // panics if there is an error in the config.
    func NewForConfigOrDie(c *rest.Config) *CrV1Client {
    	client, err := NewForConfig(c)
    	if err != nil {
    		panic(err)
    	}
    	return client
    }
    
    // New creates a new CrV1Client for the given RESTClient.
    func New(c rest.Interface) *CrV1Client {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Oct 20 04:39:39 UTC 2021
    - 3K bytes
    - Viewed (0)
  10. src/log/slog/value_test.go

    	for i, v1 := range vals {
    		for j, v2 := range vals {
    			got := v1.Equal(v2)
    			want := i == j
    			if got != want {
    				t.Errorf("%v.Equal(%v): got %t, want %t", v1, v2, got, want)
    			}
    		}
    	}
    }
    
    func panics(f func()) (b bool) {
    	defer func() {
    		if x := recover(); x != nil {
    			b = true
    		}
    	}()
    	f()
    	return false
    }
    
    func TestValueString(t *testing.T) {
    	for _, test := range []struct {
    		v    Value
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:12:08 UTC 2024
    - 6.9K bytes
    - Viewed (0)
Back to top