text stringlengths 2 1.1M | id stringlengths 11 117 | metadata dict | __index_level_0__ int64 0 885 |
|---|---|---|---|
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package trace
import (
"container/heap"
"math"
"sort"
"strings"
"time"
)
// MutatorUtil is a change in mutator utilization at a particular
// time. Mutat... | go/src/internal/trace/gc.go/0 | {
"file_path": "go/src/internal/trace/gc.go",
"repo_id": "go",
"token_count": 9854
} | 300 |
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package trace
import (
"bufio"
"fmt"
"io"
"slices"
"strings"
"internal/trace/event/go122"
"internal/trace/internal/oldtrace"
"internal/trace/version"
... | go/src/internal/trace/reader.go/0 | {
"file_path": "go/src/internal/trace/reader.go",
"repo_id": "go",
"token_count": 2698
} | 301 |
go test fuzz v1
[]byte("go 1.22 trace\x00\x00\x00\x01000\x85\x00\b0000") | go/src/internal/trace/testdata/fuzz/FuzzReader/aeb749b6bc317b66/0 | {
"file_path": "go/src/internal/trace/testdata/fuzz/FuzzReader/aeb749b6bc317b66",
"repo_id": "go",
"token_count": 37
} | 302 |
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Tests increasing and decreasing GOMAXPROCS to try and
// catch issues with stale proc state.
//go:build ignore
package main
import (
"log"
"os"
"runtim... | go/src/internal/trace/testdata/testprog/gomaxprocs.go/0 | {
"file_path": "go/src/internal/trace/testdata/testprog/gomaxprocs.go",
"repo_id": "go",
"token_count": 370
} | 303 |
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package traceviewer provides definitions of the JSON data structures
// used by the Chrome trace viewer.
//
// The official description of the format is in t... | go/src/internal/trace/traceviewer/format/format.go/0 | {
"file_path": "go/src/internal/trace/traceviewer/format/format.go",
"repo_id": "go",
"token_count": 786
} | 304 |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// builtin calls
package builtins
import "unsafe"
func f0() {}
func append1() {
var b byte
var x int
var s []byte
_ = append() // ERROR "not enough argu... | go/src/internal/types/testdata/check/builtins0.go/0 | {
"file_path": "go/src/internal/types/testdata/check/builtins0.go",
"repo_id": "go",
"token_count": 12524
} | 305 |
// -lang=go1.17
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// type declarations
package p // don't permit non-interface elements in interfaces
import "unsafe"
const pi = 3.1415
type (
N undefined /... | go/src/internal/types/testdata/check/decls0.go/0 | {
"file_path": "go/src/internal/types/testdata/check/decls0.go",
"repo_id": "go",
"token_count": 1719
} | 306 |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// terminating statements
package stmt1
func _() {}
func _() int {} /* ERROR "missing return" */
func _() int { panic(0) }
func _() int { (panic(0)) }
// b... | go/src/internal/types/testdata/check/stmt1.go/0 | {
"file_path": "go/src/internal/types/testdata/check/stmt1.go",
"repo_id": "go",
"token_count": 1526
} | 307 |
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package issue20583
const (
_ = 6e886451608 /* ERROR "malformed constant" */ /2
_ = 6e886451608i /* ERROR "malformed constant" */ /2
_ = 0 * 1e+1000000000 //... | go/src/internal/types/testdata/fixedbugs/issue20583.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue20583.go",
"repo_id": "go",
"token_count": 145
} | 308 |
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
func _[T any](x interface{}){
switch x.(type) {
case T: // ok to use a type parameter
case int:
}
switch x.(type) {
case T:
case T /* ERROR "... | go/src/internal/types/testdata/fixedbugs/issue42758.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue42758.go",
"repo_id": "go",
"token_count": 216
} | 309 |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
type Builder /* ERROR "invalid recursive type" */ [T interface{ struct{ Builder[T] } }] struct{}
type myBuilder struct {
Builder[myBuilder]
}
| go/src/internal/types/testdata/fixedbugs/issue45550.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue45550.go",
"repo_id": "go",
"token_count": 88
} | 310 |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
// For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639).
// type T1[P any] P
//
// func (T1[_]) m() {}
//
//... | go/src/internal/types/testdata/fixedbugs/issue47747.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue47747.go",
"repo_id": "go",
"token_count": 723
} | 311 |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
func f[P any](a, _ P) {
var x int
// TODO(gri) these error messages, while correct, could be better
f(a, x /* ERROR "type int of x does not match ... | go/src/internal/types/testdata/fixedbugs/issue48619.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue48619.go",
"repo_id": "go",
"token_count": 218
} | 312 |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
type integer interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 |
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}
func Add1024[T integ... | go/src/internal/types/testdata/fixedbugs/issue49247.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue49247.go",
"repo_id": "go",
"token_count": 199
} | 313 |
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
func _[S string | []byte](s S) {
var buf []byte
_ = append(buf, s...)
}
func _[S ~string | ~[]byte](s S) {
var buf []byte
_ = append(buf, s...)
... | go/src/internal/types/testdata/fixedbugs/issue50281.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue50281.go",
"repo_id": "go",
"token_count": 188
} | 314 |
// -lang=go1.12
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
type resultFlags uint
// Example from #52031.
//
// The following shifts should not produce errors on Go < 1.13, as their
// untype... | go/src/internal/types/testdata/fixedbugs/issue52031.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue52031.go",
"repo_id": "go",
"token_count": 241
} | 315 |
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
func f[P any](P) P { panic(0) }
var v func(string) int = f // ERROR "inferred type func(string) string for func(P) P does not match type func(string... | go/src/internal/types/testdata/fixedbugs/issue60747.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue60747.go",
"repo_id": "go",
"token_count": 149
} | 316 |
// -lang=go1.16
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build go1.21
package main
import "slices"
func main() {
_ = slices.Clone([]string{}) // no error should be reported here
}
| go/src/internal/types/testdata/fixedbugs/issue66064.go/0 | {
"file_path": "go/src/internal/types/testdata/fixedbugs/issue66064.go",
"repo_id": "go",
"token_count": 100
} | 317 |
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
type MyInt int32
type MyBool bool
type MyString string
type MyFunc1 func(func(int) bool)
type MyFunc2 func(int) bool
type MyFunc3 func(MyFunc2)
type... | go/src/internal/types/testdata/spec/range.go/0 | {
"file_path": "go/src/internal/types/testdata/spec/range.go",
"repo_id": "go",
"token_count": 1720
} | 318 |
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package fs
import (
"errors"
"internal/bytealg"
"slices"
)
// ReadDirFS is the interface implemented by a file system
// that provides an optimized impleme... | go/src/io/fs/readdir.go/0 | {
"file_path": "go/src/io/fs/readdir.go",
"repo_id": "go",
"token_count": 650
} | 319 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ioutil_test
import (
"io/fs"
. "io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
"testing"
)
func TestTempFile(t *testing.T) {
dir, err := T... | go/src/io/ioutil/tempfile_test.go/0 | {
"file_path": "go/src/io/ioutil/tempfile_test.go",
"repo_id": "go",
"token_count": 2418
} | 320 |
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package slog_test
import (
"context"
"log/slog"
"log/slog/internal/slogtest"
"os"
)
// A LevelHandler wraps a Handler with an Enabled method
// that retur... | go/src/log/slog/example_level_handler_test.go/0 | {
"file_path": "go/src/log/slog/example_level_handler_test.go",
"repo_id": "go",
"token_count": 668
} | 321 |
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package slog
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"log/slog/internal/buffer"
"strconv"
"sync"
"time"
"unicode/utf8"
)
// ... | go/src/log/slog/json_handler.go/0 | {
"file_path": "go/src/log/slog/json_handler.go",
"repo_id": "go",
"token_count": 3572
} | 322 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !windows && !plan9
package syslog
import (
"errors"
"fmt"
"log"
"net"
"os"
"strings"
"sync"
"time"
)
// The Priority is a combination of t... | go/src/log/syslog/syslog.go/0 | {
"file_path": "go/src/log/syslog/syslog.go",
"repo_id": "go",
"token_count": 2777
} | 323 |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package math
import "internal/cpu"
func expTrampolineSetup(x float64) float64
func expAsm(x float64) float64
func logTrampolineSetup(x float64) float64
func ... | go/src/math/arith_s390x.go/0 | {
"file_path": "go/src/math/arith_s390x.go",
"repo_id": "go",
"token_count": 1361
} | 324 |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file implements the Bits type used for testing Float operations
// via an independent (albeit slower) representations for floating-point
// numbers.
pa... | go/src/math/big/bits_test.go/0 | {
"file_path": "go/src/math/big/bits_test.go",
"repo_id": "go",
"token_count": 2235
} | 325 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// A little test program and benchmark for rational arithmetics.
// Computes a Hilbert matrix, its inverse, multiplies them
// and verifies that the product is ... | go/src/math/big/hilbert_test.go/0 | {
"file_path": "go/src/math/big/hilbert_test.go",
"repo_id": "go",
"token_count": 1564
} | 326 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package big
import (
"math"
"testing"
)
func TestZeroRat(t *testing.T) {
var x, y, z Rat
y.SetFrac64(0, 42)
if x.Cmp(&y) != 0 {
t.Errorf("x and y shou... | go/src/math/big/rat_test.go/0 | {
"file_path": "go/src/math/big/rat_test.go",
"repo_id": "go",
"token_count": 9238
} | 327 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cmplx
// Polar returns the absolute value r and phase θ of x,
// such that x = r * e**θi.
// The phase is in the range [-Pi, Pi].
func Polar(x complex1... | go/src/math/cmplx/polar.go/0 | {
"file_path": "go/src/math/cmplx/polar.go",
"repo_id": "go",
"token_count": 119
} | 328 |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Based on dim_amd64.s
#include "textflag.h"
#define PosInf 0x7FF0000000000000
#define NaN 0x7FF8000000000001
#define NegInf 0xFFF0000000000000
// func ·... | go/src/math/dim_s390x.s/0 | {
"file_path": "go/src/math/dim_s390x.s",
"repo_id": "go",
"token_count": 1121
} | 329 |
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
// Minimax polynomial approximation and other constants
DATA ·expm1rodataL22<> + 0(SB)/8, $-1.0
DATA ·expm1rodataL22<> + 8(SB)/8, $800.0E... | go/src/math/expm1_s390x.s/0 | {
"file_path": "go/src/math/expm1_s390x.s",
"repo_id": "go",
"token_count": 3218
} | 330 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package math
/*
Hypot -- sqrt(p*p + q*q), but overflows only if the result does.
*/
// Hypot returns [Sqrt](p*p + q*q), taking care to avoid
// unnecessary o... | go/src/math/hypot.go/0 | {
"file_path": "go/src/math/hypot.go",
"repo_id": "go",
"token_count": 367
} | 331 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rand
import (
"math"
)
/*
* Normal distribution
*
* See "The Ziggurat Method for Generating Random Variables"
* (Marsaglia & Tsang, 2000)
* http... | go/src/math/rand/v2/normal.go/0 | {
"file_path": "go/src/math/rand/v2/normal.go",
"repo_id": "go",
"token_count": 3813
} | 332 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package math
// The original C code and the long comment below are
// from FreeBSD's /usr/src/lib/msun/src/e_sqrt.c and
// came with this notice. The go code i... | go/src/math/sqrt.go/0 | {
"file_path": "go/src/math/sqrt.go",
"repo_id": "go",
"token_count": 2330
} | 333 |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package multipart
import (
"bytes"
"errors"
"internal/godebug"
"io"
"math"
"net/textproto"
"os"
"strconv"
)
// ErrMessageTooLarge is returned by ReadF... | go/src/mime/multipart/formdata.go/0 | {
"file_path": "go/src/mime/multipart/formdata.go",
"repo_id": "go",
"token_count": 2929
} | 334 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package mime implements parts of the MIME spec.
package mime
import (
"fmt"
"slices"
"strings"
"sync"
)
var (
mimeTypes sync.Map // map[string]st... | go/src/mime/type.go/0 | {
"file_path": "go/src/mime/type.go",
"repo_id": "go",
"token_count": 1927
} | 335 |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file implements API tests across platforms and should never have a build
// constraint.
package net
import (
"testing"
"time"
)
// someTimeout is u... | go/src/net/conn_test.go/0 | {
"file_path": "go/src/net/conn_test.go",
"repo_id": "go",
"token_count": 731
} | 336 |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !plan9
package net
import (
"os"
"syscall"
"testing"
)
func TestSpuriousENOTAVAIL(t *testing.T) {
for _, tt := range []struct {
error
ok b... | go/src/net/error_posix_test.go/0 | {
"file_path": "go/src/net/error_posix_test.go",
"repo_id": "go",
"token_count": 431
} | 337 |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package net
import (
"errors"
"io"
"os"
"syscall"
)
func (fd *netFD) status(ln int) (string, error) {
if !fd.ok() {
return "", syscall.EINVAL
}
stat... | go/src/net/file_plan9.go/0 | {
"file_path": "go/src/net/file_plan9.go",
"repo_id": "go",
"token_count": 1246
} | 338 |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file implements CGI from the perspective of a child
// process.
package cgi
import (
"bufio"
"crypto/tls"
"errors"
"fmt"
"io"
"net"
"net/http"
... | go/src/net/http/cgi/child.go/0 | {
"file_path": "go/src/net/http/cgi/child.go",
"repo_id": "go",
"token_count": 2204
} | 339 |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cookiejar
import (
"testing"
)
var punycodeTestCases = [...]struct {
s, encoded string
}{
{"", ""},
{"-", "--"},
{"-a", "-a-"},
{"-a-", "-a--"},... | go/src/net/http/cookiejar/punycode_test.go/0 | {
"file_path": "go/src/net/http/cookiejar/punycode_test.go",
"repo_id": "go",
"token_count": 3060
} | 340 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package http
import (
"io"
"net/http/httptrace"
"net/http/internal/ascii"
"net/textproto"
"slices"
"strings"
"sync"
"time"
"golang.org/x/net/http/htt... | go/src/net/http/header.go/0 | {
"file_path": "go/src/net/http/header.go",
"repo_id": "go",
"token_count": 2743
} | 341 |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package httputil_test
import (
"fmt"
"io"
"log"
"net/http"
"net/http/httptest"
"net/http/httputil"
"net/url"
"strings"
)
func ExampleDumpRequest() {
... | go/src/net/http/httputil/example_test.go/0 | {
"file_path": "go/src/net/http/httputil/example_test.go",
"repo_id": "go",
"token_count": 1309
} | 342 |
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Patterns for ServeMux routing.
package http
import (
"errors"
"fmt"
"net/url"
"strings"
"unicode"
)
// A pattern is something that can be matched aga... | go/src/net/http/pattern.go/0 | {
"file_path": "go/src/net/http/pattern.go",
"repo_id": "go",
"token_count": 5715
} | 343 |
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
package http
import _ "unsafe" // for linkname
// RoundTrip should be an internal detail,
// but widely used packages access it using linkname... | go/src/net/http/roundtrip.go/0 | {
"file_path": "go/src/net/http/roundtrip.go",
"repo_id": "go",
"token_count": 296
} | 344 |
body {}
| go/src/net/http/testdata/style.css/0 | {
"file_path": "go/src/net/http/testdata/style.css",
"repo_id": "go",
"token_count": 3
} | 345 |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm) || wasip1
package socktest
// Sockets maps a socket descriptor to the status of socket.
type Sockets map[int]Status
func (sw ... | go/src/net/internal/socktest/switch_unix.go/0 | {
"file_path": "go/src/net/internal/socktest/switch_unix.go",
"repo_id": "go",
"token_count": 261
} | 346 |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !plan9
package net
import (
"fmt"
"internal/testenv"
"os"
"runtime"
"syscall"
"testing"
"time"
)
func (ln *TCPListener) port() string {
_,... | go/src/net/listen_test.go/0 | {
"file_path": "go/src/net/listen_test.go",
"repo_id": "go",
"token_count": 9715
} | 347 |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package net
import (
"flag"
"fmt"
"net/internal/socktest"
"os"
"runtime"
"slices"
"strings"
"sync"
"testing"
"time"
)
var (
sw socktest.Switch
//... | go/src/net/main_test.go/0 | {
"file_path": "go/src/net/main_test.go",
"repo_id": "go",
"token_count": 3241
} | 348 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package net
import (
"io"
"os"
"sync"
"time"
)
// pipeDeadline is an abstraction for handling timeouts.
type pipeDeadline struct {
mu sync.Mutex // G... | go/src/net/pipe.go/0 | {
"file_path": "go/src/net/pipe.go",
"repo_id": "go",
"token_count": 2199
} | 349 |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rpc
import (
"errors"
"fmt"
"net"
"strings"
"testing"
)
type shutdownCodec struct {
responded chan int
closed bool
}
func (c *shutdownCodec... | go/src/net/rpc/client_test.go/0 | {
"file_path": "go/src/net/rpc/client_test.go",
"repo_id": "go",
"token_count": 676
} | 350 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package smtp
import (
"bufio"
"bytes"
"crypto/tls"
"crypto/x509"
"fmt"
"internal/testenv"
"io"
"net"
"net/textproto"
"runtime"
"strings"
"testing"
... | go/src/net/smtp/smtp_test.go/0 | {
"file_path": "go/src/net/smtp/smtp_test.go",
"repo_id": "go",
"token_count": 12750
} | 351 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || windows
package net
import (
"internal/bytealg"
"runtime"
"syscall"
)
// Boolean to int.
func boolint(b bool) int {
if b {
return 1
... | go/src/net/sockopt_posix.go/0 | {
"file_path": "go/src/net/sockopt_posix.go",
"repo_id": "go",
"token_count": 972
} | 352 |
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build windows
package net
import (
"internal/syscall/windows"
"syscall"
"testing"
)
const (
syscall_TCP_KEEPIDLE = windows.TCP_KEEPIDLE
syscall_TC... | go/src/net/tcpconn_keepalive_conf_windows_test.go/0 | {
"file_path": "go/src/net/tcpconn_keepalive_conf_windows_test.go",
"repo_id": "go",
"token_count": 341
} | 353 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || windows
package net
import (
"runtime"
"syscall"
)
func setNoDelay(fd *netFD, noDelay bool) error {
err := fd.pfd.SetsockoptInt(syscall... | go/src/net/tcpsockopt_posix.go/0 | {
"file_path": "go/src/net/tcpsockopt_posix.go",
"repo_id": "go",
"token_count": 162
} | 354 |
options ndots:16 | go/src/net/testdata/large-ndots-resolv.conf/0 | {
"file_path": "go/src/net/testdata/large-ndots-resolv.conf",
"repo_id": "go",
"token_count": 6
} | 355 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package textproto implements generic support for text-based request/response
// protocols in the style of HTTP, NNTP, and SMTP.
//
// The package provides:
/... | go/src/net/textproto/textproto.go/0 | {
"file_path": "go/src/net/textproto/textproto.go",
"repo_id": "go",
"token_count": 1298
} | 356 |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix
package net
import (
"internal/syscall/unix"
"os"
"syscall"
"testing"
"time"
)
func TestUnixConnReadMsgUnixSCMRightsCloseOnExec(t *testi... | go/src/net/unixsock_readmsg_test.go/0 | {
"file_path": "go/src/net/unixsock_readmsg_test.go",
"repo_id": "go",
"token_count": 1142
} | 357 |
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package os
import (
"syscall"
"unsafe"
)
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(syscall.Dirent{}.Fileno), unsafe.S... | go/src/os/dirent_freebsd.go/0 | {
"file_path": "go/src/os/dirent_freebsd.go",
"repo_id": "go",
"token_count": 473
} | 358 |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package os_test
import (
"bytes"
"errors"
"fmt"
"io/fs"
"log"
"os"
"path/filepath"
"sync"
"time"
)
func ExampleOpenFile() {
f, err := os.OpenFile("n... | go/src/os/example_test.go/0 | {
"file_path": "go/src/os/example_test.go",
"repo_id": "go",
"token_count": 3573
} | 359 |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build plan9
package fdtest
import (
"syscall"
)
const errBadFd = syscall.ErrorString("fd out of range or not open")
// Exists returns true if fd is a ... | go/src/os/exec/internal/fdtest/exists_plan9.go/0 | {
"file_path": "go/src/os/exec/internal/fdtest/exists_plan9.go",
"repo_id": "go",
"token_count": 156
} | 360 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package os
import (
"internal/itoa"
"runtime"
"syscall"
"time"
)
// The only signal values guaranteed to be present in the os package
// on all systems ar... | go/src/os/exec_plan9.go/0 | {
"file_path": "go/src/os/exec_plan9.go",
"repo_id": "go",
"token_count": 1287
} | 361 |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package os_test
import (
"fmt"
"internal/testenv"
"os"
"path/filepath"
"runtime"
"testing"
)
const executable_EnvVar = "OSTEST_OUTPUT_EXECPATH"
func Te... | go/src/os/executable_test.go/0 | {
"file_path": "go/src/os/executable_test.go",
"repo_id": "go",
"token_count": 1460
} | 362 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package os
import (
"errors"
"internal/filepathlite"
"internal/godebug"
"internal/poll"
"internal/syscall/windows"
"runtime"
"sync"
"sync/atomic"
"sys... | go/src/os/file_windows.go/0 | {
"file_path": "go/src/os/file_windows.go",
"repo_id": "go",
"token_count": 5225
} | 363 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build aix || darwin
package os
import "syscall"
// Pipe returns a connected pair of Files; reads from r return bytes written to w.
// It returns the fil... | go/src/os/pipe_unix.go/0 | {
"file_path": "go/src/os/pipe_unix.go",
"repo_id": "go",
"token_count": 286
} | 364 |
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build linux
package signal
import (
"os"
"syscall"
"testing"
"time"
)
const prSetKeepCaps = 8
// This test validates that syscall.AllThreadsSyscall... | go/src/os/signal/signal_linux_test.go/0 | {
"file_path": "go/src/os/signal/signal_linux_test.go",
"repo_id": "go",
"token_count": 432
} | 365 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package os
import (
"internal/syscall/windows"
"syscall"
)
func hostname() (name string, err error) {
// Use PhysicalDnsHostname to uniquely identify host ... | go/src/os/sys_windows.go/0 | {
"file_path": "go/src/os/sys_windows.go",
"repo_id": "go",
"token_count": 306
} | 366 |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build cgo && !osusergo && unix && !android && !darwin
package user
import (
"syscall"
)
/*
#cgo solaris CFLAGS: -D_POSIX_PTHREAD_SEMANTICS
#cgo CFLAGS:... | go/src/os/user/cgo_lookup_cgo.go/0 | {
"file_path": "go/src/os/user/cgo_lookup_cgo.go",
"repo_id": "go",
"token_count": 1681
} | 367 |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package user
import (
"fmt"
"internal/syscall/windows"
"internal/syscall/windows/registry"
"syscall"
"unsafe"
)
func isDomainJoined() (bool, error) {
va... | go/src/os/user/lookup_windows.go/0 | {
"file_path": "go/src/os/user/lookup_windows.go",
"repo_id": "go",
"token_count": 4387
} | 368 |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !windows && !plan9
package filepath_test
import (
"fmt"
"path/filepath"
)
func ExampleSplitList() {
fmt.Println("On Unix:", filepath.SplitList(... | go/src/path/filepath/example_unix_test.go/0 | {
"file_path": "go/src/path/filepath/example_unix_test.go",
"repo_id": "go",
"token_count": 1627
} | 369 |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package path
import (
"errors"
"internal/bytealg"
"unicode/utf8"
)
// ErrBadPattern indicates a pattern was malformed.
var ErrBadPattern = errors.New("synt... | go/src/path/match.go/0 | {
"file_path": "go/src/path/match.go",
"repo_id": "go",
"token_count": 2266
} | 370 |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
#include "funcdata.h"
// makeFuncStub is jumped to by the code generated by MakeFunc.
// See the comment on the declaration of makeFuncSt... | go/src/reflect/asm_arm.s/0 | {
"file_path": "go/src/reflect/asm_arm.s",
"repo_id": "go",
"token_count": 511
} | 371 |
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
// riscv64 allows 32-bit floats to live in the bottom
// part of the register, it expects them to be NaN-boxed.
// These functions are ne... | go/src/reflect/float32reg_riscv64.s/0 | {
"file_path": "go/src/reflect/float32reg_riscv64.s",
"repo_id": "go",
"token_count": 283
} | 372 |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package reflect_test
import (
. "reflect"
"strings"
"testing"
)
type structField struct {
name string
index []int
}
var fieldsTests = []struct {
testN... | go/src/reflect/visiblefields_test.go/0 | {
"file_path": "go/src/reflect/visiblefields_test.go",
"repo_id": "go",
"token_count": 2563
} | 373 |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syntax
import (
"fmt"
"strings"
"testing"
"unicode"
)
type parseTest struct {
Regexp string
Dump string
}
var parseTests = []parseTest{
// B... | go/src/regexp/syntax/parse_test.go/0 | {
"file_path": "go/src/regexp/syntax/parse_test.go",
"repo_id": "go",
"token_count": 9436
} | 374 |
#!/bin/rc -e
# Copyright 2012 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
rfork e
if(! test -f ../bin/go){
echo 'run.rc must be run from $GOROOT/src after installing cmd/go' >[1=2]
exit wrongdir
}
GOENV=off
eval `{../bin... | go/src/run.rc/0 | {
"file_path": "go/src/run.rc",
"repo_id": "go",
"token_count": 149
} | 375 |
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build asan
#include "go_asm.h"
#include "textflag.h"
// Called from instrumented code.
// func runtime·doasanread(addr unsafe.Pointer, sz, sp, pc uintptr... | go/src/runtime/asan_riscv64.s/0 | {
"file_path": "go/src/runtime/asan_riscv64.s",
"repo_id": "go",
"token_count": 938
} | 376 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
#include "abi_amd64.h"
// Set the x_crosscall2_ptr C function pointer variable point to crosscall2.
// It's such a pointer chain: _crossc... | go/src/runtime/cgo/asm_amd64.s/0 | {
"file_path": "go/src/runtime/cgo/asm_amd64.s",
"repo_id": "go",
"token_count": 581
} | 377 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
.file "gcc_386.S"
/*
* Windows still insists on underscore prefixes for C function names.
*/
#if defined(_WIN32)
#define EXT(s) _##s
#else
#define EXT(s) s
#... | go/src/runtime/cgo/gcc_386.S/0 | {
"file_path": "go/src/runtime/cgo/gcc_386.S",
"repo_id": "go",
"token_count": 391
} | 378 |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "libcgo.h"
#include "... | go/src/runtime/cgo/gcc_libinit_windows.c/0 | {
"file_path": "go/src/runtime/cgo/gcc_libinit_windows.c",
"repo_id": "go",
"token_count": 1535
} | 379 |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build linux && (amd64 || arm64 || ppc64le)
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <signal.h>
#include "l... | go/src/runtime/cgo/gcc_sigaction.c/0 | {
"file_path": "go/src/runtime/cgo/gcc_sigaction.c",
"repo_id": "go",
"token_count": 923
} | 380 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#undef nil
#define nil ((void*)0)
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
typedef uint32_t uint... | go/src/runtime/cgo/libcgo.h/0 | {
"file_path": "go/src/runtime/cgo/libcgo.h",
"repo_id": "go",
"token_count": 1271
} | 381 |
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
import (
"internal/coverage/rtcov"
"unsafe"
)
// The compiler emits calls to runtime.addCovMeta
// but this code has moved to rtcov.AddMeta.... | go/src/runtime/covermeta.go/0 | {
"file_path": "go/src/runtime/covermeta.go",
"repo_id": "go",
"token_count": 209
} | 382 |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package debug_test
import (
"os"
"runtime"
. "runtime/debug"
"testing"
)
func TestWriteHeapDumpNonempty(t *testing.T) {
if runtime.GOOS == "js" {
t.Ski... | go/src/runtime/debug/heapdump_test.go/0 | {
"file_path": "go/src/runtime/debug/heapdump_test.go",
"repo_id": "go",
"token_count": 839
} | 383 |
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime_test
import (
"runtime"
"slices"
"testing"
)
// Make sure open-coded defer exit code is not lost, even when there is an
// unconditional pa... | go/src/runtime/defer_test.go/0 | {
"file_path": "go/src/runtime/defer_test.go",
"repo_id": "go",
"token_count": 4716
} | 384 |
// created by cgo -cdefs and then converted to Go
// cgo -cdefs defs_dragonfly.go
package runtime
import "unsafe"
const (
_EINTR = 0x4
_EFAULT = 0xe
_EBUSY = 0x10
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c
_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
_O_CREAT = 0x200
_O_TRUNC = 0x400
_O_CLOEXEC = 0x2000... | go/src/runtime/defs_dragonfly_amd64.go/0 | {
"file_path": "go/src/runtime/defs_dragonfly_amd64.go",
"repo_id": "go",
"token_count": 2092
} | 385 |
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
const _PAGESIZE = 0x1000
type ureg struct {
di uint32 /* general registers */
si uint32 /* ... */
bp uint32 /* ... */
nsp uint3... | go/src/runtime/defs_plan9_386.go/0 | {
"file_path": "go/src/runtime/defs_plan9_386.go",
"repo_id": "go",
"token_count": 742
} | 386 |
// Code generated by mkduff.go; DO NOT EDIT.
// Run go generate from src/runtime to update.
// See mkduff.go for comments.
//go:build ppc64 || ppc64le
#include "textflag.h"
TEXT runtime·duffzero<ABIInternal>(SB), NOSPLIT|NOFRAME, $0-0
MOVDU R0, 8(R20)
MOVDU R0, 8(R20)
MOVDU R0, 8(R20)
MOVDU R0, 8(R20)
MOVDU R0,... | go/src/runtime/duff_ppc64x.s/0 | {
"file_path": "go/src/runtime/duff_ppc64x.s",
"repo_id": "go",
"token_count": 5756
} | 387 |
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Export debuglog guts for testing.
package runtime
const DlogEnabled = dlogEnabled
const DebugLogBytes = debugLogBytes
const DebugLogStringLimit = debugLo... | go/src/runtime/export_debuglog_test.go/0 | {
"file_path": "go/src/runtime/export_debuglog_test.go",
"repo_id": "go",
"token_count": 571
} | 388 |
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime_test
import (
"testing"
)
func TestIssue48807(t *testing.T) {
for _, i := range []uint64{
0x8234508000000001, // from issue48807
1<<56 +... | go/src/runtime/float_test.go/0 | {
"file_path": "go/src/runtime/float_test.go",
"repo_id": "go",
"token_count": 246
} | 389 |
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package startlinetest contains helpers for runtime_test.TestStartLineAsm.
package startlinetest
// Defined in func_amd64.s, this is a trivial assembly funct... | go/src/runtime/internal/startlinetest/func_amd64.go/0 | {
"file_path": "go/src/runtime/internal/startlinetest/func_amd64.go",
"repo_id": "go",
"token_count": 126
} | 390 |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build aix || darwin || netbsd || openbsd || plan9 || solaris || windows
package runtime
import (
"internal/runtime/atomic"
"unsafe"
)
// This implemen... | go/src/runtime/lock_sema.go/0 | {
"file_path": "go/src/runtime/lock_sema.go",
"repo_id": "go",
"token_count": 2883
} | 391 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
import (
"internal/runtime/atomic"
"internal/runtime/sys"
"unsafe"
)
// Per-thread (in Go, per-P) cache for small objects.
// This includes... | go/src/runtime/mcache.go/0 | {
"file_path": "go/src/runtime/mcache.go",
"repo_id": "go",
"token_count": 3445
} | 392 |
// Inferno's libkern/memset-arm.s
// https://bitbucket.org/inferno-os/inferno-os/src/master/libkern/memset-arm.s
//
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
// Revisions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved.
// ... | go/src/runtime/memclr_arm.s/0 | {
"file_path": "go/src/runtime/memclr_arm.s",
"repo_id": "go",
"token_count": 1012
} | 393 |
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
// See memmove Go doc for important implementation constraints.
// func memmove(to, from unsafe.Pointer, n uintptr)
TEXT runtime·memmove... | go/src/runtime/memmove_loong64.s/0 | {
"file_path": "go/src/runtime/memmove_loong64.s",
"repo_id": "go",
"token_count": 966
} | 394 |
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package metrics
import (
_ "runtime" // depends on the runtime via a linkname'd function
"unsafe"
)
// Sample captures a single metric sample.
type Sample s... | go/src/runtime/metrics/sample.go/0 | {
"file_path": "go/src/runtime/metrics/sample.go",
"repo_id": "go",
"token_count": 454
} | 395 |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
import (
"internal/goarch"
"internal/runtime/atomic"
"internal/runtime/sys"
"unsafe"
)
const (
_WorkbufSize = 2048 // in bytes; larger va... | go/src/runtime/mgcwork.go/0 | {
"file_path": "go/src/runtime/mgcwork.go",
"repo_id": "go",
"token_count": 4816
} | 396 |
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
import (
"internal/runtime/sys"
)
// pageBits is a bitmap representing one bit per page in a palloc chunk.
type pageBits [pallocChunkPages / ... | go/src/runtime/mpallocbits.go/0 | {
"file_path": "go/src/runtime/mpallocbits.go",
"repo_id": "go",
"token_count": 4936
} | 397 |
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !windows
package runtime
// osRelaxMinNS is the number of nanoseconds of idleness to tolerate
// without performing an osRelax. Since osRelax may r... | go/src/runtime/nonwindows_stub.go/0 | {
"file_path": "go/src/runtime/nonwindows_stub.go",
"repo_id": "go",
"token_count": 257
} | 398 |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
import (
"internal/abi"
"internal/goarch"
"unsafe"
)
type mOS struct{}
//go:noescape
func thr_new(param *thrparam, size int32) int32
//go... | go/src/runtime/os_freebsd.go/0 | {
"file_path": "go/src/runtime/os_freebsd.go",
"repo_id": "go",
"token_count": 4885
} | 399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.