package main import ( "fmt" "go/ast" "go/token" ) func main() { // Create a new file set fset := token.NewFileSet() // Generate package declaraction pkgdecl := &ast.GenDecl{ Tok: token.PACKAGE, Specs: []ast.Spec{ &ast.ValueSpec{ Names: []*ast.Ident{ast.NewIdent("main")}, Type: ast.NewIdent(""), Values: []ast.Expr{}, }, }, } // Print out package declaration fmt.Println(pkgdecl) }This code generates a package declaration for a Go file using `GenDecl`. The `Specs` field in `GenDecl` takes a slice of `ast.Spec` interfaces, which can be used to specify different types of declarations. The Go `go.ast` package is part of the standard Go library.