gofiles

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 5 Imported by: 10

Documentation

Overview

Package gofiles provides functions for specifying and writing Go source files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(dir string, files []GoFileSpec) (map[string]GoFile, error)

Write the Go files represented by the specifications in the files parameter using the provided directory as the root directory.

Returns a map of the written files where the key is the RelPath field of the specification that was written and the value is the GoFile that was written for the specification.

Types

type GoFile

type GoFile struct {
	// The absolute path to the Go file.
	Path string
	// The import path for the Go file. For example, "github.com/nmiyake/pkg/gofiles".
	ImportPath string
}

GoFile represents a Go file that has been written to disk.

type GoFileSpec

type GoFileSpec struct {
	// The relative path to which the file should be written. For example, "foo/foo.go".
	RelPath string
	// Content of the file.
	Src string
}

GoFileSpec represents the specification for a Go file.

Jump to

Keyboard shortcuts

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