files

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package files allows to interact with files on a file system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(source string, destination string) error

CopyFile copies a file from source to destination.

func CopyFolderContents

func CopyFolderContents(source string, destination string) error

CopyFolderContents copies all the files and folders within the given source folder to the destination folder.

func CopyFolderContentsWithFilter

func CopyFolderContentsWithFilter(source string, destination string, filter func(path string) bool) error

CopyFolderContentsWithFilter copies the files and folders within the given source folder that pass the given filter (return true) to the destination folder.

func CopyTerraformFolderToTemp

func CopyTerraformFolderToTemp(folderPath string, tempFolderPrefix string) (string, error)

CopyTerraformFolderToTemp creates a copy of the given folder and all its contents in a temp folder with a unique name and the given prefix. This is useful when running multiple tests in parallel against the same set of Terraform files to ensure the tests don't overwrite each other's .terraform working directory and terraform.tfstate files. This method returns the path to the temp folder with the copied contents. Hidden files and folders, Terraform state files, and terraform.tfvars files are not copied to this temp folder, as you typically don't want them interfering with your tests.

func FileExists

func FileExists(path string) bool

FileExists returns true if the given file exists.

func PathContainsHiddenFileOrFolder

func PathContainsHiddenFileOrFolder(path string) bool

PathContainsHiddenFileOrFolder returns true if the given path contains a hidden file or folder.

func PathContainsTerraformStateOrVars

func PathContainsTerraformStateOrVars(path string) bool

PathContainsTerraformStateOrVars returns true if the path corresponds to a Terraform state file or .tfvars file.

func WriteFileWithSamePermissions

func WriteFileWithSamePermissions(source string, destination string, contents []byte) error

WriteFileWithSamePermissions writes a file to the given destination with the given contents using the same permissions as the file at source.

Types

This section is empty.

Jump to

Keyboard shortcuts

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