pkg/net: added package

Support:
- various IP types
- FQDNs

Also supports:
- use of single-param builtins as types
  (consistent with curried builtins).
- fixed bug in interpretation of top
- allow unexported functions to be used by builtins

Change-Id: I3568f2383510a904e00d4cf941c753efd03679ce
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2664
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/internal/cmd/qgo/qgo.go b/internal/cmd/qgo/qgo.go
index 4d5e57d..98e89fa 100644
--- a/internal/cmd/qgo/qgo.go
+++ b/internal/cmd/qgo/qgo.go
@@ -232,8 +232,10 @@
 	if name := x.Name.Name; *stripstr && strings.HasSuffix(name, "String") {
 		newName := name[:len(name)-len("String")]
 		x.Name = ast.NewIdent(newName)
-		for _, c := range x.Doc.List {
-			c.Text = strings.Replace(c.Text, name, newName, -1)
+		if x.Doc != nil {
+			for _, c := range x.Doc.List {
+				c.Text = strings.Replace(c.Text, name, newName, -1)
+			}
 		}
 	}
 	types := []ast.Expr{}