generate

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package generate contains helper functions for code generators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrganizeImports

func OrganizeImports(codeBuffer *bytes.Buffer, filePath string) error

OrganizeImports takes a buffer containing Go code and a file path where that code will live, resolves the imports and formats the code, and writes the resulting formatted code into the buffer.

Returns nil if the code was processed and the buffer is now updated with the organized, formatted code, or an error if something went wrong during the import+format process.

func SaveBufferToFile

func SaveBufferToFile(buffer *bytes.Buffer, filePath string) error

SaveBufferToFile stores the given buffer's contents to a file at `filePath`.

Returns nil if the file was written successfully, or an error if there was an error writing the file.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL