Skip to content

Commit 08c7723

Browse files
committed
all: merge master (7f10777) into gopls-release-branch.0.8
Also update gopls/go.mod to replace x/tools. For golang/go#52213 Conflicts: - gopls/go.mod - gopls/go.sum Merge List: + 2022-04-07 7f10777 gopls/internal/regtest/modfile: temporarily skip TestSumUpdateFixesDiagnostics + 2022-04-07 7cc24c2 gopls: upgrade staticcheck to v0.3.0 + 2022-04-07 1f763df internal/lsp: add semantic tokens for arrows in declarations + 2022-04-06 b3e0236 go/ssa: Track created functions in the builder. + 2022-04-06 6731659 go/ssa: adds position info to implicit field selection instructions + 2022-04-06 74cea6e internal/imports: ignore some line directives + 2022-04-05 37acb39 internal/lsp: run vulncheck in specified dir + 2022-04-04 4077921 all: fix spelling + 2022-04-04 ff66cbe internal/lsp: remove unused parameters from moduleAtVersion + 2022-04-04 7d125fe cmd/callgraph: expand windows/arm64 skip to the whole platform + 2022-04-01 153e30b internal/lsp/lsprpc: only propagate explicit GOWORK when using remote + 2022-03-31 cda13e2 internal/lsp: fix incorrect line and start of semantic tokens + 2022-03-31 41787c4 gopls: run go mod tidy -compat=1.16 to fix the 1.16 build + 2022-03-31 b9a4807 internal/gopathwalk: remove unnecessary call to os.Lstat + 2022-03-30 8e193c2 go/ssa: removes conversion of index value in Index and IndexAddr to int + 2022-03-30 9d8009b go/analysis: validate report if analyzer.Run is empty + 2022-03-29 761e51f go/ssa/interp: Adds reflect.DeepEqual model for interp testing Change-Id: I2d9255f835fada04e125aa3bb16571a02a50d6d7
2 parents 90a7537 + 7f10777 commit 08c7723

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+970
-279
lines changed

cmd/callgraph/main_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"log"
1616
"os"
1717
"path/filepath"
18+
"runtime"
1819
"strings"
1920
"testing"
2021

@@ -34,8 +35,8 @@ func init() {
3435
}
3536

3637
func TestCallgraph(t *testing.T) {
37-
if b := os.Getenv("GO_BUILDER_NAME"); b == "windows-arm64-10" {
38-
t.Skipf("skipping due to suspected file corruption bug on %s builder (https://go.dev/issue/50706)", b)
38+
if runtime.GOOS == "windows" && runtime.GOARCH == "arm64" {
39+
t.Skipf("skipping due to suspected file corruption bug on windows/arm64 (https://go.dev/issue/50706)")
3940
}
4041

4142
testenv.NeedsTool(t, "go")

cmd/splitdwarf/splitdwarf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ for input_exe need to allow writing.
9494
// IndSym Offset = file offset (within link edit section) of 4-byte indices within symtab.
9595
//
9696
// Section __TEXT.__symbol_stub1.
97-
// Offset and size (Reserved2) locate and describe a table for thios section.
97+
// Offset and size (Reserved2) locate and describe a table for this section.
9898
// Symbols beginning at IndirectSymIndex (Reserved1) (see LC_DYSYMTAB.IndSymOffset) refer to this table.
9999
// (These table entries are apparently PLTs [Procedure Linkage Table/Trampoline])
100100
//

go/analysis/internal/checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ func codeFact(fact analysis.Fact) (analysis.Fact, error) {
826826

827827
// exportedFrom reports whether obj may be visible to a package that imports pkg.
828828
// This includes not just the exported members of pkg, but also unexported
829-
// constants, types, fields, and methods, perhaps belonging to oether packages,
829+
// constants, types, fields, and methods, perhaps belonging to other packages,
830830
// that find there way into the API.
831831
// This is an overapproximation of the more accurate approach used by
832832
// gc export data, which walks the type graph, but it's much simpler.

go/analysis/passes/nilness/testdata/src/a/a.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,16 @@ func f11(a interface{}) {
181181
return
182182
}
183183
}
184+
185+
type Y struct {
186+
innerY
187+
}
188+
189+
type innerY struct {
190+
value int
191+
}
192+
193+
func f12() {
194+
var d *Y
195+
print(d.value) // want "nil dereference in field selection"
196+
}

go/analysis/passes/sigchanyzer/sigchanyzer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
5050
}
5151
case *ast.CallExpr:
5252
// Only signal.Notify(make(chan os.Signal), os.Interrupt) is safe,
53-
// conservatively treate others as not safe, see golang/go#45043
53+
// conservatively treat others as not safe, see golang/go#45043
5454
if isBuiltinMake(pass.TypesInfo, arg) {
5555
return
5656
}

go/analysis/validate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
// Validate reports an error if any of the analyzers are misconfigured.
1515
// Checks include:
1616
// that the name is a valid identifier;
17+
// that the Doc is not empty;
18+
// that the Run is non-nil;
1719
// that the Requires graph is acyclic;
1820
// that analyzer fact types are unique;
1921
// that each fact type is a pointer.
@@ -46,6 +48,9 @@ func Validate(analyzers []*Analyzer) error {
4648
return fmt.Errorf("analyzer %q is undocumented", a)
4749
}
4850

51+
if a.Run == nil {
52+
return fmt.Errorf("analyzer %q has nil Run", a)
53+
}
4954
// fact types
5055
for _, f := range a.FactTypes {
5156
if f == nil {

go/analysis/validate_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,43 @@ import (
1111

1212
func TestValidate(t *testing.T) {
1313
var (
14+
run = func(p *Pass) (interface{}, error) {
15+
return nil, nil
16+
}
1417
dependsOnSelf = &Analyzer{
1518
Name: "dependsOnSelf",
1619
Doc: "this analyzer depends on itself",
20+
Run: run,
1721
}
1822
inCycleA = &Analyzer{
1923
Name: "inCycleA",
2024
Doc: "this analyzer depends on inCycleB",
25+
Run: run,
2126
}
2227
inCycleB = &Analyzer{
2328
Name: "inCycleB",
2429
Doc: "this analyzer depends on inCycleA and notInCycleA",
30+
Run: run,
2531
}
2632
pointsToCycle = &Analyzer{
2733
Name: "pointsToCycle",
2834
Doc: "this analyzer depends on inCycleA",
35+
Run: run,
2936
}
3037
notInCycleA = &Analyzer{
3138
Name: "notInCycleA",
3239
Doc: "this analyzer depends on notInCycleB and notInCycleC",
40+
Run: run,
3341
}
3442
notInCycleB = &Analyzer{
3543
Name: "notInCycleB",
3644
Doc: "this analyzer depends on notInCycleC",
45+
Run: run,
3746
}
3847
notInCycleC = &Analyzer{
3948
Name: "notInCycleC",
4049
Doc: "this analyzer has no dependencies",
50+
Run: run,
4151
}
4252
)
4353

@@ -116,3 +126,27 @@ func TestCycleInRequiresGraphErrorMessage(t *testing.T) {
116126
t.Errorf("error string %s does not contain expected substring %q", errMsg, wantSubstring)
117127
}
118128
}
129+
130+
func TestValidateEmptyDoc(t *testing.T) {
131+
withoutDoc := &Analyzer{
132+
Name: "withoutDoc",
133+
Run: func(p *Pass) (interface{}, error) {
134+
return nil, nil
135+
},
136+
}
137+
err := Validate([]*Analyzer{withoutDoc})
138+
if err == nil || !strings.Contains(err.Error(), "is undocumented") {
139+
t.Errorf("got unexpected error while validating analyzers withoutDoc: %v", err)
140+
}
141+
}
142+
143+
func TestValidateNoRun(t *testing.T) {
144+
withoutRun := &Analyzer{
145+
Name: "withoutRun",
146+
Doc: "this analyzer has no Run",
147+
}
148+
err := Validate([]*Analyzer{withoutRun})
149+
if err == nil || !strings.Contains(err.Error(), "has nil Run") {
150+
t.Errorf("got unexpected error while validating analyzers withoutRun: %v", err)
151+
}
152+
}

go/pointer/analysis.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ type object struct {
5959
//
6060
// ssa.Value for an object allocated by an SSA operation.
6161
// types.Type for an rtype instance object or *rtype-tagged object.
62-
// string for an instrinsic object, e.g. the array behind os.Args.
63-
// nil for an object allocated by an instrinsic.
62+
// string for an intrinsic object, e.g. the array behind os.Args.
63+
// nil for an object allocated by an intrinsic.
6464
// (cgn provides the identity of the intrinsic.)
6565
data interface{}
6666

0 commit comments

Comments
 (0)