func (f *file) checkTypeDoc(ty *ast.TypeSpec) {
	if !ast.IsExported(ty.Name.Name) {
		// type is unexported
		return
	}
	headerPrinted := false

	if ty.Doc == nil {
		// there's no existing documentation
		if !headerPrinted {
			printTypeHeader(ty)
			fmt.Println("Type is undocumented!")
			// ty.Doc = &ast.CommentGroup{}
			// ty.Doc.List = append(ty.Doc.List, &cmt)

			f.al.add(ty.Pos(), fmt.Sprintf("// FIXME: %s is undocumented", ty.Name.Name), MissingDocumentation, TypeDecl)
		}
		return
	}

	// we have previously existing documentation
	s := ty.Doc.Text()
	prefix := ty.Name.Name + " "
	if !strings.HasPrefix(s, prefix) {
		if !headerPrinted {
			printTypeHeader(ty)
			fmt.Println("Type is incorrectly documented!")
			// ty.Doc.List = append(ty.Doc.List, &cmt)

			f.al.add(ty.Pos(), fmt.Sprintf("// FIXME: %s is incorrectly documented", ty.Name.Name), IncorrectDocumentation, TypeDecl)
		}
		// fmt.Printf(fn.Doc, 1, link(docCommentsLink), category("comments"), `comment on exported %s %s should be of the form "%s...\n"`, kind, name, prefix)
	}
}
// checkTypeDoc examines doc comments on types
// It complains if they are missing, or not of the right form
checkTypeDoc examines doc comments on types
It complains if they are missing, or not of the right form
// checkTypeDoc examines doc comments on types // It complains if they are missing or not of the right form
func (f *file) checkTypeDoc(ty *ast.TypeSpec) {
	if !ast.IsExported(ty.Name.Name) {
		return
	}
	headerPrinted := false
	if ty.Doc == nil {
		if !headerPrinted {
			printTypeHeader(ty)
			fmt.Println("Type is undocumented!")
			f.al.add(ty.Pos(), fmt.Sprintf("// FIXME: %s is undocumented", ty.Name.Name), MissingDocumentation, TypeDecl)
		}
		return
	}
	s := ty.Doc.Text()
	prefix := ty.Name.Name + " "
	if !strings.HasPrefix(s, prefix) {
		if !headerPrinted {
			printTypeHeader(ty)
			fmt.Println("Type is incorrectly documented!")
			f.al.add(ty.Pos(), fmt.Sprintf("// FIXME: %s is incorrectly documented", ty.Name.Name), IncorrectDocumentation, TypeDecl)
		}
	}
}
func ( f * file ) checkTypeDoc ( ty * ast . TypeSpec ) { if ! ast . IsExported ( ty . Name . Name ) { return } headerPrinted := false if ty . Doc == nil { if ! headerPrinted { printTypeHeader ( ty ) fmt . Println ( " " ) f . al . add ( ty . Pos ( ) , fmt . Sprintf ( " " , ty . Name . Name ) , MissingDocumentation , TypeDecl ) } return } s := ty . Doc . Text ( ) prefix := ty . Name . Name + " " if ! strings . HasPrefix ( s , prefix ) { if ! headerPrinted { printTypeHeader ( ty ) fmt . Println ( " " ) f . al . add ( ty . Pos ( ) , fmt . Sprintf ( " " , ty . Name . Name ) , IncorrectDocumentation , TypeDecl ) } } }
checkTypeDoc examines doc comments on types
It complains if they are missing, or not of the right form
checkTypeDoc examines doc comments on types It complains if they are missing or not of the right form
// type is unexported // there's no existing documentation // ty.Doc = &ast.CommentGroup{} // ty.Doc.List = append(ty.Doc.List, &cmt) // we have previously existing documentation // ty.Doc.List = append(ty.Doc.List, &cmt) // fmt.Printf(fn.Doc, 1, link(docCommentsLink), category("comments"), `comment on exported %s %s should be of the form "%s...\n"`, kind, name, prefix)