modfile: add package documentation

Fixes golang/go#36757

Change-Id: I674edfabed7f4bb54c909eda56ca4a87b037fe83
Reviewed-on: https://go-review.googlesource.com/c/mod/+/216842
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/modfile/read.go b/modfile/read.go
index 1577efd..14c77b4 100644
--- a/modfile/read.go
+++ b/modfile/read.go
@@ -2,9 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Module file parser.
-// This is a simplified copy of Google's buildifier parser.
-
 package modfile
 
 import (
diff --git a/modfile/rule.go b/modfile/rule.go
index 67914a8..91d5349 100644
--- a/modfile/rule.go
+++ b/modfile/rule.go
@@ -2,6 +2,21 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Package modfile implements a parser and formatter for go.mod files.
+//
+// The go.mod syntax is described in
+// https://golang.org/cmd/go/#hdr-The_go_mod_file.
+//
+// The Parse and ParseLax functions both parse a go.mod file and return an
+// abstract syntax tree. ParseLax ignores unknown statements and may be used to
+// parse go.mod files that may have been developed with newer versions of Go.
+//
+// The File struct returned by Parse and ParseLax represent an abstract
+// go.mod file. File has several methods like AddNewRequire and DropReplace
+// that can be used to programmatically edit a file.
+//
+// The Format function formats a File back to a byte slice which can be
+// written to a file.
 package modfile
 
 import (