github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/doc/pkg.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"github.com/shogo82148/std/go/ast"
     9  	"github.com/shogo82148/std/go/build"
    10  	"github.com/shogo82148/std/go/doc"
    11  	"github.com/shogo82148/std/go/token"
    12  	"github.com/shogo82148/std/io"
    13  )
    14  
    15  type Package struct {
    16  	writer      io.Writer
    17  	name        string
    18  	userPath    string
    19  	pkg         *ast.Package
    20  	file        *ast.File
    21  	doc         *doc.Package
    22  	build       *build.Package
    23  	typedValue  map[*doc.Value]bool
    24  	constructor map[*doc.Func]bool
    25  	fs          *token.FileSet
    26  	buf         pkgBuffer
    27  }
    28  
    29  func (pkg *Package) ToText(w io.Writer, text, prefix, codePrefix string)
    30  
    31  type PackageError string
    32  
    33  func (p PackageError) Error() string
    34  
    35  // pkg.Fatalfはlog.Fatalfと似ていますが、エラーが発生するため、メインのdo関数で回復が可能であり、プログラムが終了しないようになっています。サブプロセスを実行しないでテストを実行できるようにします。ログの接頭辞はメインで追加されますが、ここでは追加されません。
    36  func (pkg *Package) Fatalf(format string, args ...any)
    37  
    38  func (pkg *Package) Printf(format string, args ...any)