Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (17 sloc) 470 Bytes
package generator
import "fmt"
// Package represents a code generator for `package` statement.
type Package struct {
name string
// NewPackage returns a new `Package`.
func NewPackage(packageName string) *Package {
return &Package{
name: packageName,
// Generate generates a package statement.
func (pg *Package) Generate(indentLevel int) (string, error) {
indent := buildIndent(indentLevel)
return fmt.Sprintf("%spackage %s\n", indent,, nil
You can’t perform that action at this time.