Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: golangci-lint
if: runner.os == 'Linux'
run: |
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.64.8 golangci-lint run -v --timeout=3600s
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v2.10.1 golangci-lint run -v
- name: Run Gosec Security Scanner
uses: securego/gosec@136f6c00402b11775d4f4a45d5a21e2f6dd99db2 #v2.22.2
if: runner.os == 'Linux'
6 changes: 3 additions & 3 deletions cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ func applyFunc(auto *bool) func(*cobra.Command, []string) error {
}
config, err := pkg.BuildGreptConfig(pwd, configPath, c.Context(), varFlags)
if err != nil {
return fmt.Errorf("error parsing config: %s\n", err.Error())
return fmt.Errorf("error parsing config: %s", err.Error())
}

plan, err := pkg.RunGreptPlan(config)
if err != nil {
return fmt.Errorf("Error generating plan: %s\n", err.Error())
return fmt.Errorf("error generating plan: %s", err.Error())
}

if len(plan.FailedRules) == 0 {
Expand All @@ -77,7 +77,7 @@ func applyFunc(auto *bool) func(*cobra.Command, []string) error {
}
err = plan.Apply()
if err != nil {
return fmt.Errorf("error applying plan: %s\n", err.Error())
return fmt.Errorf("error applying plan: %s", err.Error())
}
fmt.Println("Plan applied successfully.")
return nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func planFunc() func(*cobra.Command, []string) error {
}
config, err := pkg.BuildGreptConfig(pwd, configPath, c.Context(), varFlags)
if err != nil {
return fmt.Errorf("error parsing config: %+v\n", err)
return fmt.Errorf("error parsing config: %+v", err)
}

plan, err := pkg.RunGreptPlan(config)
if err != nil {
return fmt.Errorf("error generating plan: %s\n", err.Error())
return fmt.Errorf("error generating plan: %s", err.Error())
}

if len(plan.FailedRules) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/fix_copy_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (s *copyFileFixSuite) SetupTest() {
}

func (s *copyFileFixSuite) TearDownTest() {
s.testBase.teardown()
s.teardown()
}

func TestCopyFileFixSuite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/fix_git_ignore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (s *gitIgnoreFixSuite) SetupTest() {
}

func (s *gitIgnoreFixSuite) TearDownTest() {
s.testBase.teardown()
s.teardown()
}

func TestGitIgnoreFixSuite(t *testing.T) {
Expand Down
10 changes: 7 additions & 3 deletions pkg/fix_local_shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,17 @@ func (l *LocalShellFix) downloadFile(url string) (string, error) {
if err != nil {
return "", err
}
defer out.Close()
defer func() {
_ = out.Close()
}()

resp, err := http.Get(url)
if err != nil {
return out.Name(), err
}
defer resp.Body.Close()
defer func() {
_ = resp.Body.Close()
}()

_, err = io.Copy(out, resp.Body)
if err != nil {
Expand All @@ -126,7 +130,7 @@ func (l *LocalShellFix) createTmpFileForInlines(shebang string, inlines []string
_ = tmp.Close()
}()
writer := bufio.NewWriter(tmp)
_, err = writer.WriteString(fmt.Sprintf("#!%s\n", shebang))
_, err = fmt.Fprintf(writer, "#!%s\n", shebang)
if err != nil {
return tmp.Name(), err
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/fix_local_shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,7 @@ func (s *localExecFixSuite) TestLocalShellFix_ApplyFix_scriptWithUserAssignedEnv
defer func() {
_ = os.Remove(tmpScript.Name())
}()
_, _ = tmpScript.WriteString(fmt.Sprintf(`#!/bin/sh
echo $TMP_ENV>%s
`, resultFile.Name()))
_, _ = fmt.Fprintf(tmpScript, "#!/bin/sh\n\t\techo $TMP_ENV>%s\n", resultFile.Name())
_ = tmpScript.Close()

rand := uuid.NewString()
Expand Down
2 changes: 1 addition & 1 deletion pkg/fix_yaml_transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (y *yamlTransformSuite) SetupTest() {
}

func (y *yamlTransformSuite) TearDownTest() {
y.testBase.teardown()
y.teardown()
}

func TestYamlTransformSuite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/grept_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (y *greptConfigSuite) SetupTest() {
}

func (y *greptConfigSuite) TearDownTest() {
y.testBase.teardown()
y.teardown()
}

func TestGreptConfigSuite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/grept_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (p *GreptPlan) String() string {
sb.WriteString("\n---\n")
}
for _, f := range p.Fixes {
sb.WriteString(fmt.Sprintf("%s would be apply:\n %s\n", f.Address(), golden.BlockToString(f)))
fmt.Fprintf(&sb, "%s would be apply:\n %s\n", f.Address(), golden.BlockToString(f))
sb.WriteString("\n---\n")
}

Expand Down
Loading