amalgomate/astfuncs.go
func createMapKeyValueExpression(name, namedImport string) *ast.KeyValueExpr {
	return &ast.KeyValueExpr{
		Key: &ast.BasicLit{
			Kind:  token.STRING,
			Value: fmt.Sprintf(`"%v"`, name),
		},
		Value: &ast.FuncLit{
			Type: &ast.FuncType{
				Params: &ast.FieldList{},
			},
			Body: &ast.BlockStmt{
				List: []ast.Stmt{
					&ast.ExprStmt{
						X: &ast.CallExpr{
							Fun: &ast.SelectorExpr{
								X:   ast.NewIdent(namedImport),
								Sel: ast.NewIdent(amalgomatedMain),
							},
						},
					},
				},
			},
		},
	}
}
func createMapKeyValueExpression(name, namedImport string) *ast.KeyValueExpr {
	return &ast.KeyValueExpr{
		Key: &ast.BasicLit{
			Kind:  token.STRING,
			Value: fmt.Sprintf(`"%v"`, name),
		},
		Value: &ast.FuncLit{
			Type: &ast.FuncType{
				Params: &ast.FieldList{},
			},
			Body: &ast.BlockStmt{
				List: []ast.Stmt{
					&ast.ExprStmt{
						X: &ast.CallExpr{
							Fun: &ast.SelectorExpr{
								X:   ast.NewIdent(namedImport),
								Sel: ast.NewIdent(amalgomatedMain),
							},
						},
					},
				},
			},
		},
	}
}
func createMapKeyValueExpression ( name , namedImport string ) * ast . KeyValueExpr { return & ast . KeyValueExpr { Key : & ast . BasicLit { Kind : token . STRING , Value : fmt . Sprintf ( `"%v"` , name ) , } , Value : & ast . FuncLit { Type : & ast . FuncType { Params : & ast . FieldList { } , } , Body : & ast . BlockStmt { List : [ ] ast . Stmt { & ast . ExprStmt { X : & ast . CallExpr { Fun : & ast . SelectorExpr { X : ast . NewIdent ( namedImport ) , Sel : ast . NewIdent ( amalgomatedMain ) , } , } , } , } , } , } , } }
// createMapKeyValueExpression creates a new map key value function expression of the form "{{name}}": func() { {{namedImport}}.{{amalgomatedMain}}() }.
// In most cases "name" and "namedImport" will be the same, but if multiple commands refer to the same package, then the
// commands that are lexicographically later should refer to the named import of the first command.
createMapKeyValueExpression creates a new map key value function expression of the form {{ name }} : func () { {{ namedImport }} . {{ amalgomatedMain }} () } . In most cases name and namedImport will be the same but if multiple commands refer to the same package then the commands that are lexicographically later should refer to the named import of the first command .