Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
losisin committed Nov 17, 2023
1 parent fec27fb commit 5166eb2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ go 1.20

require (
github.com/losisin/go-jsonschema-generator v0.1.0
github.com/stretchr/testify v1.8.4
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
)
17 changes: 13 additions & 4 deletions schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,12 @@ func TestGenerateJsonSchemaPass(t *testing.T) {
for _, tt := range tests {
t.Run(fmt.Sprintf("%v", tt.conf), func(t *testing.T) {
conf := &tt.conf
generateJsonSchema(conf)
err := generateJsonSchema(conf)
if err != nil {
t.Fatalf("generateJsonSchema() failed: %v", err)
}

_, err := os.Stat(conf.outputPath)
_, err = os.Stat(conf.outputPath)
if os.IsNotExist(err) {
t.Errorf("Expected file '%q' to be created, but it doesn't exist", conf.outputPath)
}
Expand All @@ -324,7 +327,10 @@ func TestGenerateJsonSchemaPass(t *testing.T) {
})
t.Run(fmt.Sprintf("%v", tt.conf), func(t *testing.T) {
conf := &tt.conf
generateJsonSchema(conf)
err := generateJsonSchema(conf)
if err != nil {
t.Fatalf("generateJsonSchema() failed: %v", err)
}

outputJson, err := os.ReadFile(conf.outputPath)
if err != nil {
Expand Down Expand Up @@ -424,7 +430,10 @@ func TestMain(t *testing.T) {
}()

var buf bytes.Buffer
io.Copy(&buf, r)
_, err := io.Copy(&buf, r)
if err != nil {
t.Errorf("Error reading stdout: %v", err)
}

os.Args = originalArgs
os.Stdout = originalStdout
Expand Down

0 comments on commit 5166eb2

Please sign in to comment.