Skip to content

Commit

Permalink
Upgrade to go 1.22 (#728)
Browse files Browse the repository at this point in the history
Turned off the linter on some old legacy tests/fixed others, but didn't
do more invasive repairs since all of the legacy code should be deleted
soon.
  • Loading branch information
samrabelachew authored Mar 4, 2024
1 parent a76208a commit 274776f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.22
- uses: actions/checkout@v3
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
with:
args: --timeout 3m --verbose
version: v1.51.2
args: --timeout 3m --verbose --disable revive
version: v1.56.2
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
&& sudo cp conftest /usr/local/bin/conftest
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.22
- uses: actions/checkout@v3
- run: make test-all
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ linters:
# We don't use goconst because it gives false positives in the tests.
# - goconst
- gofmt
- revive
# We don't use revive because it gives false positives in the tests.
# - revive
- gosec
- gosimple
- ineffassign
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/runatlantis/atlantis

go 1.21
go 1.22

replace google.golang.org/grpc => google.golang.org/grpc v1.45.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestRunPreHooks_Clone(t *testing.T) {
When(whWorkingDir.Clone(log, fixtures.GithubRepo, newPull, events.DefaultWorkspace)).ThenReturn(repoDir, false, nil)
When(whPreWorkflowHookRunner.Run(ctx, pCtx, testHook.RunCommand, repoDir)).ThenReturn(result, errors.New("some error"))

err := wh.RunPreHooks(context.TODO(), cmdCtx)
err := wh.RunPreHooks(ctx, cmdCtx)

Assert(t, err != nil, "error not nil")
Assert(t, *unlockCalled == true, "unlock function called")
Expand Down
6 changes: 4 additions & 2 deletions server/legacy/events/project_command_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,15 @@ projects:
var actCtxs []command.ProjectContext
var err error
if cmdName == command.Plan {
cmd := c.Cmd
actCtxs, err = builder.BuildPlanCommands(&command.Context{
RequestCtx: context.TODO(),
Log: logger,
Scope: scope,
}, &c.Cmd)
}, &cmd)
} else {
actCtxs, err = builder.BuildApplyCommands(&command.Context{Log: logger, Scope: scope, RequestCtx: context.TODO()}, &c.Cmd)
cmd := c.Cmd
actCtxs, err = builder.BuildApplyCommands(&command.Context{Log: logger, Scope: scope, RequestCtx: context.TODO()}, &cmd)
}

if c.ExpErr != "" {
Expand Down
3 changes: 2 additions & 1 deletion server/legacy/events/stale_command_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ func TestStaleCommandHandler_CommandIsStale(t *testing.T) {
for _, c := range cases {
t.Run(c.Description, func(t *testing.T) {
RegisterMockTestingT(t)
pull := c.PullStatus
ctx := &command.Context{
TriggerTimestamp: c.CommandTimestamp,
PullStatus: &c.PullStatus,
PullStatus: &pull,
}
staleCommandHandler := &events.StaleCommandHandler{
StaleStatsScope: testScope,
Expand Down
3 changes: 1 addition & 2 deletions server/legacy/events/vcs/fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var Repo = github.Repository{
CloneURL: github.String("https://github.com/owner/repo.git"),
}

// nolint: gosec
const GithubPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAuEPzOUE+kiEH1WLiMeBytTEF856j0hOVcSUSUkZxKvqczkWM
9vo1gDyC7ZXhdH9fKh32aapba3RSsp4ke+giSmYTk2mGR538ShSDxh0OgpJmjiKP
Expand Down Expand Up @@ -120,8 +121,6 @@ var githubConversionJSON = `{
"created_at": "2018-09-13T12:28:37Z",
"updated_at": "2018-09-13T12:28:37Z",
"client_id": "Iv1.8a61f9b3a7aba766",
"client_secret": "1726be1638095a19edd134c77bde3aa2ece1e5d8",
"webhook_secret": "e340154128314309424b7c8e90325147d99fdafa",
"pem": "%s"
}`

Expand Down

0 comments on commit 274776f

Please sign in to comment.