Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 158 for panic (0.26 sec)

  1. src/bufio/bufio.go

    	if b.r > 0 {
    		copy(b.buf, b.buf[b.r:b.w])
    		b.w -= b.r
    		b.r = 0
    	}
    
    	if b.w >= len(b.buf) {
    		panic("bufio: tried to fill full buffer")
    	}
    
    	// Read new data: try a limited number of times.
    	for i := maxConsecutiveEmptyReads; i > 0; i-- {
    		n, err := b.rd.Read(b.buf[b.w:])
    		if n < 0 {
    			panic(errNegativeRead)
    		}
    		b.w += n
    		if err != nil {
    			b.err = err
    			return
    		}
    		if n > 0 {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Oct 12 14:39:08 GMT 2023
    - 21.8K bytes
    - Viewed (0)
  2. src/cmd/api/main_test.go

    }
    
    func (w *Walker) emitf(format string, args ...any) {
    	f := strings.Join(w.scope, ", ") + ", " + fmt.Sprintf(format, args...)
    	if strings.Contains(f, "\n") {
    		panic("feature contains newlines: " + f)
    	}
    
    	if _, dup := w.features[f]; dup {
    		panic("duplicate feature inserted: " + f)
    	}
    	w.features[f] = true
    
    	if verbose {
    		log.Printf("feature: %s", f)
    	}
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Apr 09 20:48:51 GMT 2024
    - 31.4K bytes
    - Viewed (0)
  3. src/bufio/scan_test.go

    func TestDontLoopForever(t *testing.T) {
    	s := NewScanner(strings.NewReader("abc"))
    	s.Split(loopAtEOFSplit)
    	// Expect a panic
    	defer func() {
    		err := recover()
    		if err == nil {
    			t.Fatal("should have panicked")
    		}
    		if msg, ok := err.(string); !ok || !strings.Contains(msg, "empty tokens") {
    			panic(err)
    		}
    	}()
    	for count := 0; s.Scan(); count++ {
    		if count > 1000 {
    			t.Fatal("looping")
    		}
    	}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Sep 22 16:22:42 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  4. internal/lsync/lrwmutex.go

    	success := lm.unlock(isWriteLock)
    	if !success {
    		panic("Trying to Unlock() while no Lock() is active")
    	}
    }
    
    // RUnlock releases a read lock held on lm.
    //
    // It is a run-time error if lm is not locked on entry to RUnlock.
    func (lm *LRWMutex) RUnlock() {
    	isWriteLock := false
    	success := lm.unlock(isWriteLock)
    	if !success {
    		panic("Trying to RUnlock() while no RLock() is active")
    	}
    }
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Jan 02 17:15:06 GMT 2022
    - 4.8K bytes
    - Viewed (0)
  5. internal/bpool/bpool.go

    // byte arrays sized based on width.
    func NewBytePoolCap(maxSize uint64, width int, capwidth int) (bp *BytePoolCap) {
    	if capwidth > 0 && capwidth < 64 {
    		panic("buffer capped with smaller than 64 bytes is not supported")
    	}
    	if capwidth > 0 && width > capwidth {
    		panic("buffer length cannot be > capacity of the buffer")
    	}
    	return &BytePoolCap{
    		c:    make(chan []byte, maxSize),
    		w:    width,
    		wcap: capwidth,
    	}
    }
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 19 16:44:59 GMT 2024
    - 2.6K bytes
    - Viewed (0)
  6. src/bytes/buffer_test.go

    	}
    }
    
    type panicReader struct{ panic bool }
    
    func (r panicReader) Read(p []byte) (int, error) {
    	if r.panic {
    		panic("oops")
    	}
    	return 0, io.EOF
    }
    
    // Make sure that an empty Buffer remains empty when
    // it is "grown" before a Read that panics
    func TestReadFromPanicReader(t *testing.T) {
    
    	// First verify non-panic behaviour
    	var buf Buffer
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Apr 26 13:31:36 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  7. internal/logger/console.go

    	}
    	logJSON, err := json.Marshal(&log.Entry{
    		Level:   FatalKind,
    		Message: message,
    		Time:    time.Now().UTC(),
    		Trace:   &log.Trace{Message: message, Source: []string{getSource(6)}},
    	})
    	if err != nil {
    		panic(err)
    	}
    	fmt.Println(string(logJSON))
    
    	ExitFunc(1)
    }
    
    func (f fatalMsg) quiet(msg string, args ...interface{}) {
    	f.pretty(msg, args...)
    }
    
    var (
    	logTag      = "ERROR"
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Feb 02 00:13:57 GMT 2024
    - 5.7K bytes
    - Viewed (0)
  8. tests/transaction_test.go

    			if err := tx.First(&User{}, "name = ?", user.Name).Error; err != nil {
    				t.Fatalf("Should find saved record")
    			}
    
    			panic("force panic")
    		})
    	})
    
    	if err := DB.First(&User{}, "name = ?", "transaction-block-3").Error; err == nil {
    		t.Fatalf("Should not find record after panic rollback")
    	}
    }
    
    func TestTransactionRaiseErrorOnRollbackAfterCommit(t *testing.T) {
    	tx := DB.Begin()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  9. doc/godebug.md

    The [GODEBUG History](#history) gives the exact defaults for each Go toolchain version.
    For example, Go 1.21 introduces the `panicnil` setting,
    controlling whether `panic(nil)` is allowed;
    it defaults to `panicnil=0`, making `panic(nil)` a run-time error.
    Using `panicnil=1` restores the behavior of Go 1.20 and earlier.
    
    When compiling a work module or workspace that declares
    Plain Text
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Apr 16 17:29:58 GMT 2024
    - 13.5K bytes
    - Viewed (0)
  10. src/archive/zip/register.go

    	if _, dup := decompressors.LoadOrStore(method, dcomp); dup {
    		panic("decompressor already registered")
    	}
    }
    
    // RegisterCompressor registers custom compressors for a specified method ID.
    // The common methods [Store] and [Deflate] are built in.
    func RegisterCompressor(method uint16, comp Compressor) {
    	if _, dup := compressors.LoadOrStore(method, comp); dup {
    		panic("compressor already registered")
    	}
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Oct 13 18:36:46 GMT 2023
    - 3.7K bytes
    - Viewed (0)
Back to top