text stringlengths 2 1.1M | id stringlengths 11 117 | metadata dict | __index_level_0__ int64 0 885 |
|---|---|---|---|
// 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 ignore
package testdata
type I interface {
Foo()
}
type J interface {
I
Bar()
}
type A struct{}
func (a A) Foo() {}
func (a A) Bar() {}
typ... | tools/go/callgraph/vta/testdata/src/fields.go/0 | {
"file_path": "tools/go/callgraph/vta/testdata/src/fields.go",
"repo_id": "tools",
"token_count": 464
} | 700 |
// 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 ignore
package testdata
type A struct{}
func (a A) foo() {}
type I interface{ foo() }
func Baz(i I) {
j := &i
k := &j
**k = A{}
i.foo()
(*... | tools/go/callgraph/vta/testdata/src/store_load_alias.go/0 | {
"file_path": "tools/go/callgraph/vta/testdata/src/store_load_alias.go",
"repo_id": "tools",
"token_count": 533
} | 701 |
// This file is named go.fake.mod so it does not define a real module, which
// would make the contents of this directory unavailable to the test when run
// from outside the repository.
go 1.23.0 //@mark(αMarker, "1.23.0")
use ./αβ //@mark(βMarker, "αβ")
| tools/go/expect/testdata/go.fake.work/0 | {
"file_path": "tools/go/expect/testdata/go.fake.work",
"repo_id": "tools",
"token_count": 84
} | 702 |
// 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.
// Except for this comment, this file is a verbatim copy of the file
// with the same name in $GOROOT/src/go/internal/gccgoimporter.
package gccgoimporter
imp... | tools/go/internal/gccgoimporter/gccgoinstallation_test.go/0 | {
"file_path": "tools/go/internal/gccgoimporter/gccgoinstallation_test.go",
"repo_id": "tools",
"token_count": 1852
} | 703 |
v1;
package imports;
pkgpath imports;
priority 7;
import fmt fmt "fmt";
init imports imports..import 7 math math..import 1 runtime runtime..import 1 strconv strconv..import 2 io io..import 3 reflect reflect..import 3 syscall syscall..import 3 time time..import 4 os os..import 5 fmt fmt..import 6;
var Hello <type -16>;
| tools/go/internal/gccgoimporter/testdata/imports.gox/0 | {
"file_path": "tools/go/internal/gccgoimporter/testdata/imports.gox",
"repo_id": "tools",
"token_count": 93
} | 704 |
package pointer
type Int8Ptr *int8
| tools/go/internal/gccgoimporter/testdata/pointer.go/0 | {
"file_path": "tools/go/internal/gccgoimporter/testdata/pointer.go",
"repo_id": "tools",
"token_count": 12
} | 705 |
// 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.
/*
Package packages loads Go packages for inspection and analysis.
The [Load] function takes as input a list of patterns and returns a
list of [Package] values... | tools/go/packages/doc.go/0 | {
"file_path": "tools/go/packages/doc.go",
"repo_id": "tools",
"token_count": 2794
} | 706 |
// 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.
package packagestest_test
import (
"path/filepath"
"testing"
"golang.org/x/tools/go/packages/packagestest"
)
func TestGOPATHExport(t *testing.T) {
export... | tools/go/packages/packagestest/gopath_test.go/0 | {
"file_path": "tools/go/packages/packagestest/gopath_test.go",
"repo_id": "tools",
"token_count": 434
} | 707 |
package fake1
type ATestType string //@check("ATestType","ATestType")
| tools/go/packages/packagestest/testdata/test_test.go/0 | {
"file_path": "tools/go/packages/packagestest/testdata/test_test.go",
"repo_id": "tools",
"token_count": 23
} | 708 |
// 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.
package ssa
// This file implements the CREATE phase of SSA construction.
// See builder.go for explanation.
import (
"fmt"
"go/ast"
"go/token"
"go/types"... | tools/go/ssa/create.go/0 | {
"file_path": "tools/go/ssa/create.go",
"repo_id": "tools",
"token_count": 3334
} | 709 |
// 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.
package interp
import (
"bytes"
"fmt"
"go/constant"
"go/token"
"go/types"
"os"
"reflect"
"strings"
"sync"
"unsafe"
"golang.org/x/tools/go/ssa"
"go... | tools/go/ssa/interp/ops.go/0 | {
"file_path": "tools/go/ssa/interp/ops.go",
"repo_id": "tools",
"token_count": 15236
} | 710 |
package main
// Tests of interface conversions and type assertions.
type I0 interface {
}
type I1 interface {
f()
}
type I2 interface {
f()
g()
}
type C0 struct{}
type C1 struct{}
func (C1) f() {}
type C2 struct{}
func (C2) f() {}
func (C2) g() {}
func main() {
var i0 I0
var i1 I1
var i2 I2
// Nil always... | tools/go/ssa/interp/testdata/ifaceconv.go/0 | {
"file_path": "tools/go/ssa/interp/testdata/ifaceconv.go",
"repo_id": "tools",
"token_count": 640
} | 711 |
package errors
func New(text string) error { return errorString{text} }
type errorString struct{ s string }
func (e errorString) Error() string { return e.s }
| tools/go/ssa/interp/testdata/src/errors/errors.go/0 | {
"file_path": "tools/go/ssa/interp/testdata/src/errors/errors.go",
"repo_id": "tools",
"token_count": 47
} | 712 |
package main
// Static tests of SSA builder (via the sanity checker).
// Dynamic semantics are not exercised.
func init() {
// Regression test for issue 6806.
ch := make(chan int)
select {
case n, _ := <-ch:
_ = n
default:
// The default case disables the simplification of
// select to a simple receive sta... | tools/go/ssa/interp/testdata/static.go/0 | {
"file_path": "tools/go/ssa/interp/testdata/static.go",
"repo_id": "tools",
"token_count": 403
} | 713 |
// 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 ssautil_test
import (
"bytes"
"go/ast"
"go/importer"
"go/parser"
"go/token"
"go/types"
"os"
"path"
"strings"
"testing"
"golang.org/x/tools/... | tools/go/ssa/ssautil/load_test.go/0 | {
"file_path": "tools/go/ssa/ssautil/load_test.go",
"repo_id": "tools",
"token_count": 2263
} | 714 |
package encoding
type BinaryMarshaler interface {
MarshalBinary() (data []byte, err error)
}
type BinaryUnmarshaler interface {
UnmarshalBinary(data []byte) error
}
| tools/go/ssa/testdata/src/encoding/encoding.go/0 | {
"file_path": "tools/go/ssa/testdata/src/encoding/encoding.go",
"repo_id": "tools",
"token_count": 54
} | 715 |
package time
type Duration int64
func Sleep(Duration)
func NewTimer(d Duration) *Timer
type Timer struct {
C <-chan Time
}
func (t *Timer) Stop() bool
type Time struct{}
func After(d Duration) <-chan Time
const (
Nanosecond Duration = iota // Specific values do not matter here.
Second
Minute
Hour
)
| tools/go/ssa/testdata/src/time/time.go/0 | {
"file_path": "tools/go/ssa/testdata/src/time/time.go",
"repo_id": "tools",
"token_count": 105
} | 716 |
// 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 typeutil_test
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"go/types"
"testing"
"golang.org/x/tools/go/types/typeutil"
)
type closure map[st... | tools/go/types/typeutil/imports_test.go/0 | {
"file_path": "tools/go/types/typeutil/imports_test.go",
"repo_id": "tools",
"token_count": 747
} | 717 |
// 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.
// This file contains the infrastructure to create an
// identifier and full-text index for a set of Go files.
//
// Algorithm for identifier index:
// - traver... | tools/godoc/index.go/0 | {
"file_path": "tools/godoc/index.go",
"repo_id": "tools",
"token_count": 16235
} | 718 |
// 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.
package godoc
// ----------------------------------------------------------------------------
// SpotInfo
// A SpotInfo value describes a particular identifie... | tools/godoc/spot.go/0 | {
"file_path": "tools/godoc/spot.go",
"repo_id": "tools",
"token_count": 660
} | 719 |
<!--
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.
-->
{{$query_url := urlquery .Query}}
{{if not .Idents}}
{{with .Pak}}
<h2 id="Packages">Package {{html $.Query}}</h2>
<p>
<table class="layout">
{{range... | tools/godoc/static/searchcode.html/0 | {
"file_path": "tools/godoc/static/searchcode.html",
"repo_id": "tools",
"token_count": 818
} | 720 |
// 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.
// Package mapfs file provides an implementation of the FileSystem
// interface based on the contents of a map[string]string.
package mapfs // import "golang.or... | tools/godoc/vfs/mapfs/mapfs.go/0 | {
"file_path": "tools/godoc/vfs/mapfs/mapfs.go",
"repo_id": "tools",
"token_count": 1530
} | 721 |
# Gopls: Completion
TODO(golang/go#62022): document
| tools/gopls/doc/features/completion.md/0 | {
"file_path": "tools/gopls/doc/features/completion.md",
"repo_id": "tools",
"token_count": 24
} | 722 |
# gopls/v0.16.0
<!-- TODO: update this instruction once v0.16.0 is released.
Also, tweak the img URLs when publishing to GitHub Releases:
https://raw.githubusercontent.com/golang/v0.16.0/gopls/doc/ etc
-->
```
go install golang.org/x/tools/gopls@v0.16.0-pre.2
```
This release includes several features and ... | tools/gopls/doc/release/v0.16.0.md/0 | {
"file_path": "tools/gopls/doc/release/v0.16.0.md",
"repo_id": "tools",
"token_count": 3217
} | 723 |
# 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.
# Build gopls, and run the govim integration tests. See README.md for
# instructions on how to use this.
substitutions:
# This bucket must be owned by the GCP ... | tools/gopls/integration/govim/cloudbuild.yaml/0 | {
"file_path": "tools/gopls/integration/govim/cloudbuild.yaml",
"repo_id": "tools",
"token_count": 654
} | 724 |
// 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 fillreturns
import (
"bytes"
_ "embed"
"fmt"
"go/ast"
"go/format"
"go/types"
"regexp"
"strings"
"golang.org/x/tools/go/analysis"
"golang.org... | tools/gopls/internal/analysis/fillreturns/fillreturns.go/0 | {
"file_path": "tools/gopls/internal/analysis/fillreturns/fillreturns.go",
"repo_id": "tools",
"token_count": 2872
} | 725 |
// 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 infertypeargs
import (
"go/ast"
"go/token"
"go/types"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/inspect"
"golang.o... | tools/gopls/internal/analysis/infertypeargs/infertypeargs.go/0 | {
"file_path": "tools/gopls/internal/analysis/infertypeargs/infertypeargs.go",
"repo_id": "tools",
"token_count": 1714
} | 726 |
// 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.
package norangeoverfunc
// TODO(adonovan): delete this when #67237 and dominikh/go-tools#1494 are fixed.
import (
_ "embed"
"fmt"
"go/ast"
"go/types"
"g... | tools/gopls/internal/analysis/norangeoverfunc/norangeoverfunc.go/0 | {
"file_path": "tools/gopls/internal/analysis/norangeoverfunc/norangeoverfunc.go",
"repo_id": "tools",
"token_count": 515
} | 727 |
// 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 undeclared
func x() int {
var z int
z = y // want "(undeclared name|undefined): y"
if z == m { // want "(undeclared name|undefined): m"
z = 1
}
... | tools/gopls/internal/analysis/undeclaredname/testdata/src/a/a.go/0 | {
"file_path": "tools/gopls/internal/analysis/undeclaredname/testdata/src/a/a.go",
"repo_id": "tools",
"token_count": 204
} | 728 |
// 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 typeparams
import (
"bytes"
"fmt"
"net/http"
)
type parent[T any] interface {
n(f T)
}
type yuh[T any] struct {
a T
}
func (y *yuh[int]) n(f bo... | tools/gopls/internal/analysis/unusedparams/testdata/src/typeparams/typeparams.go/0 | {
"file_path": "tools/gopls/internal/analysis/unusedparams/testdata/src/typeparams/typeparams.go",
"repo_id": "tools",
"token_count": 399
} | 729 |
// 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 cache
import (
"context"
"crypto/sha256"
"fmt"
"go/ast"
"go/build"
"go/parser"
"go/token"
"go/types"
"regexp"
"runtime"
"sort"
"strings"
"... | tools/gopls/internal/cache/check.go/0 | {
"file_path": "tools/gopls/internal/cache/check.go",
"repo_id": "tools",
"token_count": 23974
} | 730 |
// 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 metadata
import (
"sort"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/gopls/internal/protocol"
"golang.org/x/tools/gopls/internal/util/bug... | tools/gopls/internal/cache/metadata/graph.go/0 | {
"file_path": "tools/gopls/internal/cache/metadata/graph.go",
"repo_id": "tools",
"token_count": 4318
} | 731 |
// 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 cache
import (
"os"
"testing"
"github.com/google/go-cmp/cmp"
"golang.org/x/sync/errgroup"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/g... | tools/gopls/internal/cache/port_test.go/0 | {
"file_path": "tools/gopls/internal/cache/port_test.go",
"repo_id": "tools",
"token_count": 1243
} | 732 |
// 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 cmd
import (
"context"
"fmt"
"os"
"path/filepath"
"testing"
"golang.org/x/tools/gopls/internal/cache"
"golang.org/x/tools/gopls/internal/protoc... | tools/gopls/internal/cmd/capabilities_test.go/0 | {
"file_path": "tools/gopls/internal/cmd/capabilities_test.go",
"repo_id": "tools",
"token_count": 1934
} | 733 |
// 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 cmd
import (
"strconv"
"strings"
"unicode/utf8"
"golang.org/x/tools/gopls/internal/protocol"
)
// parseSpan returns the location represented by t... | tools/gopls/internal/cmd/parsespan.go/0 | {
"file_path": "tools/gopls/internal/cmd/parsespan.go",
"repo_id": "tools",
"token_count": 1132
} | 734 |
show diagnostic results for the specified file
Usage:
gopls [flags] check <filename>
Example: show the diagnostic results of this file:
$ gopls check internal/cmd/check.go
| tools/gopls/internal/cmd/usage/check.hlp/0 | {
"file_path": "tools/gopls/internal/cmd/usage/check.hlp",
"repo_id": "tools",
"token_count": 50
} | 735 |
display selected identifier's references
Usage:
gopls [flags] references [references-flags] <position>
Example:
$ # 1-indexed location (:line:column or :#offset) of the target identifier
$ gopls references helper/helper.go:8:6
$ gopls references helper/helper.go:#53
references-flags:
-d,-declaration
inc... | tools/gopls/internal/cmd/usage/references.hlp/0 | {
"file_path": "tools/gopls/internal/cmd/usage/references.hlp",
"repo_id": "tools",
"token_count": 117
} | 736 |
// 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 debug exports debug information for gopls.
package debug
import (
"bytes"
"context"
"encoding/json"
"runtime"
"testing"
"golang.org/x/tools/g... | tools/gopls/internal/debug/info_test.go/0 | {
"file_path": "tools/gopls/internal/debug/info_test.go",
"repo_id": "tools",
"token_count": 549
} | 737 |
// 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 fuzzy_test
import (
"bytes"
"sort"
"testing"
"golang.org/x/tools/gopls/internal/fuzzy"
)
var rolesTests = []struct {
str string
want string
}{... | tools/gopls/internal/fuzzy/input_test.go/0 | {
"file_path": "tools/gopls/internal/fuzzy/input_test.go",
"repo_id": "tools",
"token_count": 1257
} | 738 |
// 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 completion
import (
"context"
"go/types"
"strings"
"time"
)
// MaxDeepCompletions limits deep completion results because in most cases
// there ar... | tools/gopls/internal/golang/completion/deep_completion.go/0 | {
"file_path": "tools/gopls/internal/golang/completion/deep_completion.go",
"repo_id": "tools",
"token_count": 3765
} | 739 |
// 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 completion
import (
"fmt"
"go/ast"
"go/token"
"go/types"
"strings"
"golang.org/x/tools/gopls/internal/cache"
"golang.org/x/tools/gopls/internal... | tools/gopls/internal/golang/completion/statements.go/0 | {
"file_path": "tools/gopls/internal/golang/completion/statements.go",
"repo_id": "tools",
"token_count": 4176
} | 740 |
// 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 golang
import (
"bytes"
"context"
"encoding/json"
"fmt"
"go/ast"
"go/constant"
"go/doc"
"go/format"
"go/token"
"go/types"
"io/fs"
"path/fil... | tools/gopls/internal/golang/hover.go/0 | {
"file_path": "tools/gopls/internal/golang/hover.go",
"repo_id": "tools",
"token_count": 17778
} | 741 |
// 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.
package golang
// This file defines the Semantic Tokens operation for Go source.
import (
"bytes"
"context"
"errors"
"fmt"
"go/ast"
"go/token"
"go/type... | tools/gopls/internal/golang/semtok.go/0 | {
"file_path": "tools/gopls/internal/golang/semtok.go",
"repo_id": "tools",
"token_count": 11935
} | 742 |
// 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 progress
import (
"context"
"fmt"
"sync"
"testing"
"golang.org/x/tools/gopls/internal/protocol"
)
type fakeClient struct {
protocol.Client
to... | tools/gopls/internal/progress/progress_test.go/0 | {
"file_path": "tools/gopls/internal/progress/progress_test.go",
"repo_id": "tools",
"token_count": 1831
} | 743 |
// 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 main
import (
"bytes"
"fmt"
"log"
"sort"
"strings"
)
var (
// tsclient.go has 3 sections
cdecls = make(sortedMap[string])
ccases = make(sorted... | tools/gopls/internal/protocol/generate/output.go/0 | {
"file_path": "tools/gopls/internal/protocol/generate/output.go",
"repo_id": "tools",
"token_count": 5798
} | 744 |
// 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.
// Code generated for LSP. DO NOT EDIT.
package protocol
// Code generated from protocol/metaModel.json at ref release/protocol/3.17.6-next.2 (hash 654dc9be66... | tools/gopls/internal/protocol/tsjson.go/0 | {
"file_path": "tools/gopls/internal/protocol/tsjson.go",
"repo_id": "tools",
"token_count": 21618
} | 745 |
// 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 server
import (
"context"
"fmt"
"golang.org/x/tools/gopls/internal/file"
"golang.org/x/tools/gopls/internal/golang"
"golang.org/x/tools/gopls/int... | tools/gopls/internal/server/definition.go/0 | {
"file_path": "tools/gopls/internal/server/definition.go",
"repo_id": "tools",
"token_count": 714
} | 746 |
// 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.
// Package server defines gopls' implementation of the LSP server
// interface, [protocol.Server]. Call [New] to create an instance.
package server
import (
"... | tools/gopls/internal/server/server.go/0 | {
"file_path": "tools/gopls/internal/server/server.go",
"repo_id": "tools",
"token_count": 6136
} | 747 |
// 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 settings
import (
"reflect"
"testing"
"time"
)
func TestDefaultsEquivalence(t *testing.T) {
opts1 := DefaultOptions()
opts2 := DefaultOptions()
... | tools/gopls/internal/settings/settings_test.go/0 | {
"file_path": "tools/gopls/internal/settings/settings_test.go",
"repo_id": "tools",
"token_count": 2262
} | 748 |
// 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 bench
import (
"flag"
"fmt"
"sync/atomic"
"testing"
"golang.org/x/tools/gopls/internal/protocol"
. "golang.org/x/tools/gopls/internal/test/integ... | tools/gopls/internal/test/integration/bench/completion_test.go/0 | {
"file_path": "tools/gopls/internal/test/integration/bench/completion_test.go",
"repo_id": "tools",
"token_count": 3270
} | 749 |
// 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 codelens
import (
"runtime"
"testing"
"golang.org/x/tools/gopls/internal/protocol"
"golang.org/x/tools/gopls/internal/protocol/command"
"golang.o... | tools/gopls/internal/test/integration/codelens/gcdetails_test.go/0 | {
"file_path": "tools/gopls/internal/test/integration/codelens/gcdetails_test.go",
"repo_id": "tools",
"token_count": 1259
} | 750 |
// 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 integration
import (
"fmt"
"regexp"
"sort"
"strings"
"github.com/google/go-cmp/cmp"
"golang.org/x/tools/gopls/internal/protocol"
"golang.org/x/... | tools/gopls/internal/test/integration/expectation.go/0 | {
"file_path": "tools/gopls/internal/test/integration/expectation.go",
"repo_id": "tools",
"token_count": 8093
} | 751 |
// 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.
package misc
import (
"fmt"
"testing"
"github.com/google/go-cmp/cmp"
"golang.org/x/tools/gopls/internal/protocol"
"golang.org/x/tools/gopls/internal/sett... | tools/gopls/internal/test/integration/misc/codeactions_test.go/0 | {
"file_path": "tools/gopls/internal/test/integration/misc/codeactions_test.go",
"repo_id": "tools",
"token_count": 1259
} | 752 |
// 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 misc
import (
"testing"
. "golang.org/x/tools/gopls/internal/test/integration"
)
func TestMultipleAdHocPackages(t *testing.T) {
Run(t, `
-- a/a.go... | tools/gopls/internal/test/integration/misc/multiple_adhoc_test.go/0 | {
"file_path": "tools/gopls/internal/test/integration/misc/multiple_adhoc_test.go",
"repo_id": "tools",
"token_count": 411
} | 753 |
// 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 integration
import (
"context"
"flag"
"fmt"
"os"
"runtime"
"testing"
"time"
"golang.org/x/tools/gopls/internal/cache"
"golang.org/x/tools/gop... | tools/gopls/internal/test/integration/regtest.go/0 | {
"file_path": "tools/gopls/internal/test/integration/regtest.go",
"repo_id": "tools",
"token_count": 2150
} | 754 |
// 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.
package workspace
import (
"testing"
. "golang.org/x/tools/gopls/internal/test/integration"
)
func TestWorkspacePackagesExcludesVendor(t *testing.T) {
// ... | tools/gopls/internal/test/integration/workspace/vendor_test.go/0 | {
"file_path": "tools/gopls/internal/test/integration/workspace/vendor_test.go",
"repo_id": "tools",
"token_count": 634
} | 755 |
// 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.
// The immutable package defines immutable wrappers around common data
// structures. These are used for additional type safety inside gopls.
//
// See the "per... | tools/gopls/internal/util/immutable/immutable.go/0 | {
"file_path": "tools/gopls/internal/util/immutable/immutable.go",
"repo_id": "tools",
"token_count": 409
} | 756 |
// 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.
// Code generated by copying from golang.org/x/vuln@v1.0.1 (go run copier.go); DO NOT EDIT.
// Package govulncheck contains the JSON output structs for govulnc... | tools/gopls/internal/vulncheck/govulncheck/govulncheck.go/0 | {
"file_path": "tools/gopls/internal/vulncheck/govulncheck/govulncheck.go",
"repo_id": "tools",
"token_count": 1696
} | 757 |
// 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 work
import (
"context"
"errors"
"fmt"
"io/fs"
"os"
"path/filepath"
"sort"
"strings"
"golang.org/x/tools/gopls/internal/cache"
"golang.org/x... | tools/gopls/internal/work/completion.go/0 | {
"file_path": "tools/gopls/internal/work/completion.go",
"repo_id": "tools",
"token_count": 1800
} | 758 |
// 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.
// TODO: test swap corresponding types (e.g. u1 <-> u2 and u2 <-> u1)
// TODO: test exported alias refers to something in another package -- does correspondence... | tools/internal/apidiff/apidiff.go/0 | {
"file_path": "tools/internal/apidiff/apidiff.go",
"repo_id": "tools",
"token_count": 2497
} | 759 |
// 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 lcs
import (
"log"
"sort"
)
// lcs is a longest common sequence
type lcs []diag
// A diag is a piece of the edit graph where A[X+i] == B[Y+i], for ... | tools/internal/diff/lcs/common.go/0 | {
"file_path": "tools/internal/diff/lcs/common.go",
"repo_id": "tools",
"token_count": 1905
} | 760 |
// 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 core
import (
"context"
"sync/atomic"
"time"
"unsafe"
"golang.org/x/tools/internal/event/label"
)
// Exporter is a function that handles events.... | tools/internal/event/core/export.go/0 | {
"file_path": "tools/internal/event/core/export.go",
"repo_id": "tools",
"token_count": 679
} | 761 |
// 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 ocagent_test
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"sync"
"testing"
"time"
"golang.org/x/tools/internal/event"
"... | tools/internal/event/export/ocagent/ocagent_test.go/0 | {
"file_path": "tools/internal/event/export/ocagent/ocagent_test.go",
"repo_id": "tools",
"token_count": 2484
} | 762 |
// 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 !go1.11
// +build !go1.11
package gcimporter
import "go/types"
func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface {... | tools/internal/gcimporter/newInterface10.go/0 | {
"file_path": "tools/internal/gcimporter/newInterface10.go",
"repo_id": "tools",
"token_count": 210
} | 763 |
// 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 gocommand
import (
"context"
"fmt"
"regexp"
"strings"
)
// GoVersion reports the minor version number of the highest release
// tag built into the... | tools/internal/gocommand/version.go/0 | {
"file_path": "tools/internal/gocommand/version.go",
"repo_id": "tools",
"token_count": 778
} | 764 |
// 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 jsonrpc2
import (
"context"
"errors"
"io"
"math"
"net"
"os"
"time"
"golang.org/x/tools/internal/event"
)
// NOTE: This file provides an exper... | tools/internal/jsonrpc2/serve.go/0 | {
"file_path": "tools/internal/jsonrpc2/serve.go",
"repo_id": "tools",
"token_count": 1487
} | 765 |
// 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 jsonrpc2_test
import (
"context"
"errors"
"fmt"
"runtime/debug"
"testing"
"time"
jsonrpc2 "golang.org/x/tools/internal/jsonrpc2_v2"
"golang.or... | tools/internal/jsonrpc2_v2/serve_test.go/0 | {
"file_path": "tools/internal/jsonrpc2_v2/serve_test.go",
"repo_id": "tools",
"token_count": 3979
} | 766 |
// Code generated by "stringer -type=SyncMarker -trimprefix=Sync"; DO NOT EDIT.
package pkgbits
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[SyncEOF-1]
_ = x[... | tools/internal/pkgbits/syncmarker_string.go/0 | {
"file_path": "tools/internal/pkgbits/syncmarker_string.go",
"repo_id": "tools",
"token_count": 1314
} | 767 |
// 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 inline_test
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"go/types"
"testing"
"golang.org/x/tools/internal/refactor/inline"
)
// TestCalleeE... | tools/internal/refactor/inline/calleefx_test.go/0 | {
"file_path": "tools/internal/refactor/inline/calleefx_test.go",
"repo_id": "tools",
"token_count": 1925
} | 768 |
Test of inlining a function that uses a dot import.
-- go.mod --
module testdata
go 1.12
-- a/a.go --
package a
func A() {}
-- b/b.go --
package b
import . "testdata/a"
func B() { A() }
-- c/c.go --
package c
import "testdata/b"
func _() {
b.B() //@ inline(re"B", result)
}
-- result --
package c
import (
"... | tools/internal/refactor/inline/testdata/dotimport.txtar/0 | {
"file_path": "tools/internal/refactor/inline/testdata/dotimport.txtar",
"repo_id": "tools",
"token_count": 169
} | 769 |
Tests of various n-ary result function cases.
-- go.mod --
module testdata
go 1.12
-- a/a.go --
package a
func _() {
println(f1()) //@ inline(re"f1", f1)
}
func f1() (int, int) { return 1, 1 }
-- f1 --
package a
func _() {
println(1, 1) //@ inline(re"f1", f1)
}
func f1() (int, int) { return 1, 1 }
-- b/b.go -... | tools/internal/refactor/inline/testdata/n-ary.txtar/0 | {
"file_path": "tools/internal/refactor/inline/testdata/n-ary.txtar",
"repo_id": "tools",
"token_count": 490
} | 770 |
// 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.
// The gostacks command processes stdin looking for things that look like
// stack traces and simplifying them to make the log more readable.
// It collates sta... | tools/internal/stack/gostacks/gostacks.go/0 | {
"file_path": "tools/internal/stack/gostacks/gostacks.go",
"repo_id": "tools",
"token_count": 198
} | 771 |
//go:build go1.22
package versions // want "post.go@go1.22"
| tools/internal/testfiles/testdata/versions/post.go/0 | {
"file_path": "tools/internal/testfiles/testdata/versions/post.go",
"repo_id": "tools",
"token_count": 25
} | 772 |
// 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 typeparams
import (
"errors"
"fmt"
"go/types"
"os"
"strings"
)
//go:generate go run copytermlist.go
const debug = false
var ErrEmptyTypeSet = e... | tools/internal/typeparams/normalize.go/0 | {
"file_path": "tools/internal/typeparams/normalize.go",
"repo_id": "tools",
"token_count": 2255
} | 773 |
// 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 versions
import (
"go/types"
)
// GoVersion returns the Go version of the type package.
// It returns zero if no version can be determined.
func GoVe... | tools/internal/versions/types.go/0 | {
"file_path": "tools/internal/versions/types.go",
"repo_id": "tools",
"token_count": 165
} | 774 |
// 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.
package present
import (
"fmt"
"strings"
)
func init() {
Register("iframe", parseIframe)
}
type Iframe struct {
Cmd string // original command from pr... | tools/present/iframe.go/0 | {
"file_path": "tools/present/iframe.go",
"repo_id": "tools",
"token_count": 405
} | 775 |
<!-- media.html -->
| tools/present/testdata/media.html/0 | {
"file_path": "tools/present/testdata/media.html",
"repo_id": "tools",
"token_count": 7
} | 776 |
package template
// Basic test of expression refactoring.
// (Types are not important in this case; it could be done with gofmt -r.)
import "time"
func before(t time.Time) time.Duration { return time.Now().Sub(t) }
func after(t time.Time) time.Duration { return time.Since(t) }
| tools/refactor/eg/testdata/B.template/0 | {
"file_path": "tools/refactor/eg/testdata/B.template",
"repo_id": "tools",
"token_count": 88
} | 777 |
package G1
import "go/ast"
func example() {
_ = ast.BadExpr{From: 123, To: 456} // match
_ = ast.BadExpr{123, 456} // no match
_ = ast.BadExpr{From: 123} // no match
_ = ast.BadExpr{To: 456} // no match
}
| tools/refactor/eg/testdata/G1.go/0 | {
"file_path": "tools/refactor/eg/testdata/G1.go",
"repo_id": "tools",
"token_count": 124
} | 778 |
// 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 importgraph computes the forward and reverse import
// dependency graphs for all packages in a Go workspace.
package importgraph // import "golang.or... | tools/refactor/importgraph/graph.go/0 | {
"file_path": "tools/refactor/importgraph/graph.go",
"repo_id": "tools",
"token_count": 1656
} | 779 |
# This Docker container is used for testing on GCB.
ARG GOVERSION=1
FROM golang:${GOVERSION} AS gobuilder
ENV GOBIN /gobin
# Install other Go tools tests depend on
RUN mkdir -p /scratch/installtools
ADD extension/tools/installtools/main.go /scratch/installtools/main.go
RUN go run /scratch/installtools/main.go
FROM n... | vscode-go/build/Dockerfile/0 | {
"file_path": "vscode-go/build/Dockerfile",
"repo_id": "vscode-go",
"token_count": 562
} | 780 |
# Debugging with Legacy Debug Adapter
The Go extension historically used a small adapter program to work with the Go debugger, [Delve].
The extension transitioned to communicate with [Delve] directly but there are still cases you may
need to use the legacy debug adapter (e.g. remote debugging). This document explains ... | vscode-go/docs/debugging-legacy.md/0 | {
"file_path": "vscode-go/docs/debugging-legacy.md",
"repo_id": "vscode-go",
"token_count": 7691
} | 781 |
{
"extends": "./node_modules/gts/",
"root": true
}
| vscode-go/extension/.eslintrc.json/0 | {
"file_path": "vscode-go/extension/.eslintrc.json",
"repo_id": "vscode-go",
"token_count": 26
} | 782 |
# Debug Adapter
See the [contribution documentation](../../docs/contributing.md) to learn how to develop the debug adapter.
| vscode-go/extension/src/debugAdapter/README.md/0 | {
"file_path": "vscode-go/extension/src/debugAdapter/README.md",
"repo_id": "vscode-go",
"token_count": 32
} | 783 |
/*---------------------------------------------------------
* Copyright 2022 The Go Authors. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------*/
import vscode = require('vscode');
import vscodeUri ... | vscode-go/extension/src/goExplorer.ts/0 | {
"file_path": "vscode-go/extension/src/goExplorer.ts",
"repo_id": "vscode-go",
"token_count": 3945
} | 784 |
/* eslint-disable @typescript-eslint/no-explicit-any */
/*---------------------------------------------------------
* Copyright 2021 The Go Authors. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*-------------------------------------------------------... | vscode-go/extension/src/goSurvey.ts/0 | {
"file_path": "vscode-go/extension/src/goSurvey.ts",
"repo_id": "vscode-go",
"token_count": 3264
} | 785 |
/* eslint-disable @typescript-eslint/no-explicit-any */
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
* Modification copyright 2020 The Go Authors. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for lice... | vscode-go/extension/src/language/goLanguageServer.ts/0 | {
"file_path": "vscode-go/extension/src/language/goLanguageServer.ts",
"repo_id": "vscode-go",
"token_count": 20203
} | 786 |
/*---------------------------------------------------------
* Copyright 2022 The Go Authors. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------*/
// find a random day in the next 4 weeks, starting ... | vscode-go/extension/src/utils/randomDayutils.ts/0 | {
"file_path": "vscode-go/extension/src/utils/randomDayutils.ts",
"repo_id": "vscode-go",
"token_count": 246
} | 787 |
/* eslint-disable node/no-unpublished-import */
/*---------------------------------------------------------
* Copyright 2023 The Go Authors. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------*/
imp... | vscode-go/extension/test/gopls/telemetry.test.ts/0 | {
"file_path": "vscode-go/extension/test/gopls/telemetry.test.ts",
"repo_id": "vscode-go",
"token_count": 2695
} | 788 |
/* eslint-disable no-prototype-builtins */
/* eslint-disable node/no-unpublished-import */
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
* Modification copyright 2020 The Go Authors. All rights reserved.
* Licensed under the MIT License. See L... | vscode-go/extension/test/integration/statusbar.test.ts/0 | {
"file_path": "vscode-go/extension/test/integration/statusbar.test.ts",
"repo_id": "vscode-go",
"token_count": 1793
} | 789 |
package main
import (
"testing"
)
func BenchmarkSample(b *testing.B) {
b.Run("sample test passing", func(t *testing.B) {
})
b.Run("sample test failing", func(t *testing.B) {
t.FailNow()
})
testName := "dynamic test name"
b.Run(testName, func(t *testing.B) {
t.FailNow()
})
}
| vscode-go/extension/test/testdata/codelens/codelens_benchmark_test.go/0 | {
"file_path": "vscode-go/extension/test/testdata/codelens/codelens_benchmark_test.go",
"repo_id": "vscode-go",
"token_count": 122
} | 790 |
module github.com/microsoft/vscode-go/gofixtures/coveragetest
go 1.14
| vscode-go/extension/test/testdata/coverage/go.mod/0 | {
"file_path": "vscode-go/extension/test/testdata/coverage/go.mod",
"repo_id": "vscode-go",
"token_count": 28
} | 791 |
package abc
func hello() {
var x int
_ = x
} | vscode-go/extension/test/testdata/gogetdocTestData/format.go/0 | {
"file_path": "vscode-go/extension/test/testdata/gogetdocTestData/format.go",
"repo_id": "vscode-go",
"token_count": 24
} | 792 |
package main
import "time"
func main() {
for {
time.Sleep(10*time.Millisecond)
}
}
| vscode-go/extension/test/testdata/loop/loop.go/0 | {
"file_path": "vscode-go/extension/test/testdata/loop/loop.go",
"repo_id": "vscode-go",
"token_count": 37
} | 793 |
// +build randomtag
package main
import (
"fmt"
"testing"
)
// TestMe
func TestMe(t *testing.T) {
fmt.Println("Tests passed!")
}
| vscode-go/extension/test/testdata/testTags/hello_test.go/0 | {
"file_path": "vscode-go/extension/test/testdata/testTags/hello_test.go",
"repo_id": "vscode-go",
"token_count": 59
} | 794 |
jq -r .version package.json
cp ../README.md README.md
npx vsce package -o go-0.0.0-rc.1.vsix --baseContentUrl https://github.com/golang/vscode-go/raw/v0.0.0-rc.1 --baseImagesUrl https://github.com/golang/vscode-go/raw/v0.0.0-rc.1 --no-update-package-json --no-git-tag-version 0.0.0-rc.1
| vscode-go/extension/tools/release/testdata/package-v0.0.0-rc.1.golden/0 | {
"file_path": "vscode-go/extension/tools/release/testdata/package-v0.0.0-rc.1.golden",
"repo_id": "vscode-go",
"token_count": 133
} | 795 |
// 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 autocert
import (
"context"
"os"
"path/filepath"
"reflect"
"testing"
)
// make sure DirCache satisfies Cache interface
var _ Cache = DirCache("/"... | crypto/acme/autocert/cache_test.go/0 | {
"file_path": "crypto/acme/autocert/cache_test.go",
"repo_id": "crypto",
"token_count": 603
} | 0 |
// 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 argon2
import (
"bytes"
"encoding/hex"
"testing"
)
var (
genKatPassword = []byte{
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, ... | crypto/argon2/argon2_test.go/0 | {
"file_path": "crypto/argon2/argon2_test.go",
"repo_id": "crypto",
"token_count": 4292
} | 1 |
// 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 bn256
import (
"bytes"
"crypto/rand"
"math/big"
"testing"
)
func TestGFp2Invert(t *testing.T) {
pool := new(bnPool)
a := newGFp2(pool)
a.x.Set... | crypto/bn256/bn256_test.go/0 | {
"file_path": "crypto/bn256/bn256_test.go",
"repo_id": "crypto",
"token_count": 3486
} | 2 |
// 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.
// Based on CRYPTOGAMS code with the following comment:
// # ====================================================================
// # Written by Andy Polyakov ... | crypto/chacha20/chacha_ppc64le.s/0 | {
"file_path": "crypto/chacha20/chacha_ppc64le.s",
"repo_id": "crypto",
"token_count": 5154
} | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.