golang/go

x/mod/modfile: document which fields in a parsed modfile may be nil

Open

#60,898 opened on Jun 20, 2023

View on GitHub
 (1 comment) (1 reaction) (1 assignee)Go (19,008 forks)batch import
DocumentationNeedsInvestigationhelp wantedmodules

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

We've had several crashes in gopls related to modfile.File.Module being nil.

On the other hand, we have a bunch of code checking if modfile.File.Module.Syntax is nil -- is that possible if modfile.File.Module is non-nil?

It would be nice if the modfile API documented which fields may be nil.

CC @bcmills @adonovan

Contributor guide