Skip to content

x/tools/gopls: Completion: "ZeroString for unexpected type" panic #70744

Closed
@adonovan

Description

@adonovan
#!stacks
"runtime.gopanic" && "ZeroString:+15"

Issue created by stacks.

Looks like an untyped or invalid BasicType:

func ZeroString(t types.Type, qf types.Qualifier) string {
	switch t := t.(type) {
	case *types.Basic:
		switch {
		case t.Info()&types.IsBoolean != 0:
			return "false"
		case t.Info()&types.IsNumeric != 0:
			return "0"
		case t.Info()&types.IsString != 0:
			return `""`
		case t.Kind() == types.UnsafePointer:
			fallthrough
		case t.Kind() == types.UntypedNil:
			return "nil"
		default:
			panic(fmt.Sprint("ZeroString for unexpected type:", t))
		}

This stack A4anUg was reported by telemetry:

golang.org/x/tools/[email protected] go1.23.3 linux/amd64 other,vscode (3)

Metadata

Metadata

Assignees

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/telemetry-wins

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions