Skip to content

Commit

Permalink
fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
devsergiy committed Sep 26, 2023
1 parent 4ca9d9b commit 63c05a2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions v2/internal/pkg/unsafeparser/unsafeparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package unsafeparser

import (
"io/ioutil"
"os"

"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
"github.com/wundergraph/graphql-go-tools/v2/pkg/astparser"
Expand All @@ -26,7 +26,7 @@ func ParseGraphqlDocumentBytes(input []byte) ast.Document {
}

func ParseGraphqlDocumentFile(filePath string) ast.Document {
fileBytes, err := ioutil.ReadFile(filePath)
fileBytes, err := os.ReadFile(filePath)
if err != nil {
panic(err)
}
Expand Down
9 changes: 4 additions & 5 deletions v2/pkg/astvalidation/reference/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand All @@ -23,13 +22,13 @@ func main() {
workingDir = filepath.Join(currDir, "pkg/astvalidation/reference/__tests__")
}

dir, err := ioutil.ReadDir(workingDir)
dir, err := os.ReadDir(workingDir)
if err != nil {
log.Fatal(err)
}

replacementsPath := workingDir + "/../replacements.yml"
replacementContent, _ := ioutil.ReadFile(replacementsPath)
replacementContent, _ := os.ReadFile(replacementsPath)

var replacements []Replacement
if err := yaml.Unmarshal(replacementContent, &replacements); err != nil {
Expand Down Expand Up @@ -112,7 +111,7 @@ func skipRule(name string) bool {
// processFile - convert and save reference test file
func processFile(workingDir string, filename string, replacements Replacements) {
fPath := filepath.Join(workingDir, filename)
fileContent, _ := ioutil.ReadFile(fPath)
fileContent, _ := os.ReadFile(fPath)

testName := strings.TrimSuffix(strings.Split(filepath.Base(filename), ".")[0], "-test")

Expand All @@ -129,7 +128,7 @@ func processFile(workingDir string, filename string, replacements Replacements)
result := converter.iterateLines(testName, content)

outFileName := testName + "_test.go"
err := ioutil.WriteFile(filepath.Join(outDir, outFileName), []byte(result), os.ModePerm)
err := os.WriteFile(filepath.Join(outDir, outFileName), []byte(result), os.ModePerm)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion v2/pkg/engine/plan/visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (v *Visitor) AllowVisitor(kind astvisitor.VisitorKind, ref int, visitor int

enclosingTypeName := v.Walker.EnclosingTypeDefinition.NameString(v.Definition)
shouldWalkFieldsOnPath :=
// check if the field path has type condition and matches the enclosing type
// check if the field path has type condition and matches the enclosing type
config.shouldWalkFieldsOnPath(path, enclosingTypeName) ||
// check if the planner has path without type condition
// this could happen in case of union type
Expand Down
6 changes: 3 additions & 3 deletions v2/pkg/starwars/starwars.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package starwars

import (
"encoding/json"
"io/ioutil"
"os"
"path"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -57,13 +57,13 @@ func SetRelativePathToStarWarsPackage(path string) {
}

func Schema(t TestingTB) []byte {
schema, err := ioutil.ReadFile(path.Join(testdataPath, "testdata/star_wars.graphql"))
schema, err := os.ReadFile(path.Join(testdataPath, "testdata/star_wars.graphql"))
require.NoError(t, err)
return schema
}

func LoadQuery(t TestingTB, fileName string, variables QueryVariables) []byte {
query, err := ioutil.ReadFile(path.Join(testdataPath, fileName))
query, err := os.ReadFile(path.Join(testdataPath, fileName))
require.NoError(t, err)

return RequestBody(t, string(query), variables)
Expand Down

0 comments on commit 63c05a2

Please sign in to comment.