Fix some go linter warnings

This commit is contained in:
2025-11-15 16:42:46 +01:00
parent 4fb25d0463
commit 5f1fdfa6c1
8 changed files with 84 additions and 99 deletions

View File

@@ -85,7 +85,7 @@ END`
// Run the isolate commands
result, err := RunIsolateCommands(association, "test.txt", testContent, false)
if err != nil && err != NothingToDo {
if err != nil && err != ErrNothingToDo {
t.Fatalf("Failed to run isolate commands: %v", err)
}
@@ -163,7 +163,7 @@ END_SECTION2`
// Run the isolate commands
result, err := RunIsolateCommands(associations["test.txt"], "test.txt", testContent, false)
if err != nil && err != NothingToDo {
if err != nil && err != ErrNothingToDo {
t.Fatalf("Failed to run isolate commands: %v", err)
}
@@ -235,7 +235,7 @@ func TestIsolateCommandsWithJSONMode(t *testing.T) {
// Run the isolate commands
result, err := RunIsolateCommands(associations["test.json"], "test.json", testContent, false)
if err != nil && err != NothingToDo {
if err != nil && err != ErrNothingToDo {
t.Fatalf("Failed to run isolate commands: %v", err)
}
@@ -310,7 +310,7 @@ END_REGULAR`
// First run isolate commands
isolateResult, err := RunIsolateCommands(association, "test.txt", testContent, false)
if err != nil && err != NothingToDo {
if err != nil && err != ErrNothingToDo {
t.Fatalf("Failed to run isolate commands: %v", err)
}
@@ -321,7 +321,7 @@ END_REGULAR`
// Then run regular commands
commandLoggers := make(map[string]*logger.Logger)
finalResult, err := RunOtherCommands("test.txt", isolateResult, association, commandLoggers, false)
if err != nil && err != NothingToDo {
if err != nil && err != ErrNothingToDo {
t.Fatalf("Failed to run regular commands: %v", err)
}
@@ -364,12 +364,12 @@ irons_spellbooks:chain_lightning
// Second command: targets all SpellPowerMultiplier with multiplier *4
commands := []utils.ModifyCommand{
{
Name: "healing",
Name: "healing",
Regexes: []string{
`irons_spellbooks:chain_creeper[\s\S]*?SpellPowerMultiplier = !num`,
`irons_spellbooks:chain_lightning[\s\S]*?SpellPowerMultiplier = !num`,
},
Lua: `v1 * 4`, // This should multiply by 4
Lua: `v1 * 4`, // This should multiply by 4
Files: []string{"irons_spellbooks-server.toml"},
Reset: true,
Isolate: true,
@@ -377,7 +377,7 @@ irons_spellbooks:chain_lightning
{
Name: "spellpower",
Regex: `SpellPowerMultiplier = !num`,
Lua: `v1 * 4`, // This should multiply by 4 again
Lua: `v1 * 4`, // This should multiply by 4 again
Files: []string{"irons_spellbooks-server.toml"},
Reset: true,
Isolate: true,
@@ -398,7 +398,7 @@ irons_spellbooks:chain_lightning
// Run the isolate commands
result, err := RunIsolateCommands(association, "irons_spellbooks-server.toml", testContent, false)
if err != nil && err != NothingToDo {
if err != nil && err != ErrNothingToDo {
t.Fatalf("Failed to run isolate commands: %v", err)
}
@@ -414,4 +414,4 @@ irons_spellbooks:chain_lightning
t.Logf("Original content:\n%s\n", testContent)
t.Logf("Result content:\n%s\n", result)
}
}