Skip to content

Commit

Permalink
Merge pull request #51 from cychiang/bugfix-linting-errors
Browse files Browse the repository at this point in the history
bugfix: linting errors - S1007 and SA1019
  • Loading branch information
ulucinar authored Jan 16, 2023
2 parents 1d69b37 + ea366f4 commit 9b6a115
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
"regexp"
"sigs.k8s.io/yaml"
"strings"
"time"

"sigs.k8s.io/yaml"

"github.com/crossplane/crossplane-runtime/pkg/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
kyaml "k8s.io/apimachinery/pkg/util/yaml"
Expand All @@ -23,8 +23,8 @@ import (
var (
charset = []rune("abcdefghijklmnopqrstuvwxyz0123456789")

dataSourceRegex = regexp.MustCompile("\\${data\\.(.*?)}")
randomStrRegex = regexp.MustCompile("\\${Rand\\.(.*?)}")
dataSourceRegex = regexp.MustCompile(`\${data\.(.*?)}`)
randomStrRegex = regexp.MustCompile(`\${Rand\.(.*?)}`)

caseDirectory = "case"
)
Expand Down Expand Up @@ -105,7 +105,7 @@ func (p *Preparer) PrepareManifests() ([]config.Manifest, error) {
func (p *Preparer) injectVariables() (map[string]string, error) {
dataSourceMap := make(map[string]string)
if p.dataSourcePath != "" {
dataSource, err := ioutil.ReadFile(p.dataSourcePath)
dataSource, err := os.ReadFile(p.dataSourcePath)
if err != nil {
return nil, errors.Wrap(err, "cannot read data source file")
}
Expand All @@ -116,7 +116,7 @@ func (p *Preparer) injectVariables() (map[string]string, error) {

inputs := make(map[string]string, len(p.testFilePaths))
for _, f := range p.testFilePaths {
manifestData, err := ioutil.ReadFile(f)
manifestData, err := os.ReadFile(f)
if err != nil {
return nil, errors.Wrapf(err, "cannot read %s", f)
}
Expand Down
4 changes: 4 additions & 0 deletions internal/templates/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ package templates
import _ "embed" // nolint:golint

// inputFileTemplate is the template for the input file.
//
//go:embed 00-apply.yaml.tmpl
var inputFileTemplate string

// assertFileTemplate is the template for the assert file.
//
//go:embed 00-assert.yaml.tmpl
var assertFileTemplate string

// deleteFileTemplate is the template for the delete file.
//
//go:embed 01-delete.yaml.tmpl
var deleteFileTemplate string

// assertDeletedFileTemplate is the template for delete assert file.
//
//go:embed 01-assert.yaml.tmpl
var assertDeletedFileTemplate string

0 comments on commit 9b6a115

Please sign in to comment.