mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-05 02:58:33 +00:00
chore: Fix Go Static Check Errors (#3637)
* Fix Go Static Checks * Fix working dir tests
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"testing"
|
||||
|
||||
. "github.com/petergtz/pegomock/v4"
|
||||
pegomock "github.com/petergtz/pegomock/v4"
|
||||
"github.com/runatlantis/atlantis/server/events"
|
||||
eventMocks "github.com/runatlantis/atlantis/server/events/mocks"
|
||||
"github.com/runatlantis/atlantis/server/events/models"
|
||||
@@ -59,7 +58,7 @@ func TestClone_GithubAppNoneExisting(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClone_GithubAppSetsCorrectUrl(t *testing.T) {
|
||||
pegomock.RegisterMockTestingT(t)
|
||||
RegisterMockTestingT(t)
|
||||
|
||||
workingDir := eventMocks.NewMockWorkingDir()
|
||||
|
||||
|
||||
@@ -496,7 +496,6 @@ func TestPlanCommandRunner_ExecutionOrder(t *testing.T) {
|
||||
}
|
||||
|
||||
planCommandRunner.Run(ctx, cmd)
|
||||
type RepoModel interface{ models.Repo }
|
||||
|
||||
for i := range c.ProjectContexts {
|
||||
projectCommandRunner.VerifyWasCalled(c.RunnerInvokeMatch[i]).Plan(c.ProjectContexts[i])
|
||||
|
||||
@@ -734,7 +734,7 @@ func (p *DefaultProjectCommandBuilder) buildProjectCommandCtx(ctx *command.Conte
|
||||
if repoCfgPtr.ParallelPlan != nil {
|
||||
parallelPlan = *repoCfgPtr.ParallelPlan
|
||||
}
|
||||
abortOnExcecutionOrderFail = *&repoCfgPtr.AbortOnExcecutionOrderFail
|
||||
abortOnExcecutionOrderFail = repoCfgPtr.AbortOnExcecutionOrderFail
|
||||
}
|
||||
|
||||
if len(matchingProjects) > 0 {
|
||||
|
||||
@@ -194,7 +194,7 @@ func (cb *PolicyCheckProjectCommandContextBuilder) BuildProjectContext(
|
||||
terraformClient,
|
||||
)
|
||||
|
||||
if cmdName == command.Plan && prjCfg.PolicyCheck != false {
|
||||
if cmdName == command.Plan && prjCfg.PolicyCheck {
|
||||
ctx.Log.Debug("Building project command context for %s", command.PolicyCheck)
|
||||
steps := prjCfg.Workflow.PolicyCheck.Steps
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ func (p *DefaultProjectFinder) DetermineProjectsViaConfig(log logging.SimpleLogg
|
||||
// If any of the modified files matches the pattern then this project is
|
||||
// considered modified.
|
||||
for _, file := range modifiedFiles {
|
||||
match, err := pm.Matches(file)
|
||||
match, err := pm.MatchesOrParentMatches(file)
|
||||
if err != nil {
|
||||
log.Debug("match err for file %q: %s", file, err)
|
||||
continue
|
||||
@@ -266,7 +266,7 @@ func (p *DefaultProjectFinder) filterToFileList(log logging.SimpleLogging, files
|
||||
if p.shouldIgnore(fileName) {
|
||||
continue
|
||||
}
|
||||
match, err := patternMatcher.Matches(fileName)
|
||||
match, err := patternMatcher.MatchesOrParentMatches(fileName)
|
||||
if err != nil {
|
||||
log.Debug("filter err for file %q: %s", fileName, err)
|
||||
continue
|
||||
|
||||
@@ -63,9 +63,9 @@ func (d *DefaultWorkingDirLocker) TryLockPull(repoFullName string, pullNum int)
|
||||
pullKey := d.pullKey(repoFullName, pullNum)
|
||||
for _, l := range d.locks {
|
||||
if l == pullKey || strings.HasPrefix(l, pullKey+"/") {
|
||||
return func() {}, fmt.Errorf("The Atlantis working dir is currently locked by another" +
|
||||
return func() {}, fmt.Errorf("the Atlantis working dir is currently locked by another" +
|
||||
" command that is running for this pull request.\n" +
|
||||
"Wait until the previous command is complete and try again.")
|
||||
"Wait until the previous command is complete and try again")
|
||||
}
|
||||
}
|
||||
d.locks = append(d.locks, pullKey)
|
||||
@@ -82,9 +82,9 @@ func (d *DefaultWorkingDirLocker) TryLock(repoFullName string, pullNum int, work
|
||||
workspaceKey := d.workspaceKey(repoFullName, pullNum, workspace, path)
|
||||
for _, l := range d.locks {
|
||||
if l == pullKey || l == workspaceKey {
|
||||
return func() {}, fmt.Errorf("The %s workspace at path %s is currently locked by another"+
|
||||
return func() {}, fmt.Errorf("the %s workspace at path %s is currently locked by another"+
|
||||
" command that is running for this pull request.\n"+
|
||||
"Wait until the previous command is complete and try again.", workspace, path)
|
||||
"Wait until the previous command is complete and try again", workspace, path)
|
||||
}
|
||||
}
|
||||
d.locks = append(d.locks, workspaceKey)
|
||||
|
||||
@@ -33,9 +33,9 @@ func TestTryLock(t *testing.T) {
|
||||
|
||||
// Now another lock for the same repo, workspace, and pull should fail
|
||||
_, err = locker.TryLock(repo, 1, workspace, path)
|
||||
ErrEquals(t, "The default workspace at path . is currently locked by another"+
|
||||
ErrEquals(t, "the default workspace at path . is currently locked by another"+
|
||||
" command that is running for this pull request.\n"+
|
||||
"Wait until the previous command is complete and try again.", err)
|
||||
"Wait until the previous command is complete and try again", err)
|
||||
|
||||
// Unlock should work.
|
||||
unlockFn()
|
||||
|
||||
Reference in New Issue
Block a user