Skip to content

Commit bd96e30

Browse files
Copilotlpcox
andcommitted
Clean up trailing whitespace in config files
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent e7a14fe commit bd96e30

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

internal/config/config_core.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ type ServerConfig struct {
9292
// LoadFromFile loads configuration from a TOML file.
9393
func LoadFromFile(path string) (*Config, error) {
9494
logConfig.Printf("Loading configuration from file: %s", path)
95-
95+
9696
// Open file for streaming
9797
file, err := os.Open(path)
9898
if err != nil {
@@ -108,12 +108,12 @@ func LoadFromFile(path string) (*Config, error) {
108108
// Extract position information from ParseError for better error messages
109109
// Try pointer type first (for compatibility)
110110
if perr, ok := err.(*toml.ParseError); ok {
111-
return nil, fmt.Errorf("failed to parse TOML at line %d, column %d: %s",
111+
return nil, fmt.Errorf("failed to parse TOML at line %d, column %d: %s",
112112
perr.Position.Line, perr.Position.Col, perr.Message)
113113
}
114114
// Try value type (used by toml.Decode)
115115
if perr, ok := err.(toml.ParseError); ok {
116-
return nil, fmt.Errorf("failed to parse TOML at line %d, column %d: %s",
116+
return nil, fmt.Errorf("failed to parse TOML at line %d, column %d: %s",
117117
perr.Position.Line, perr.Position.Col, perr.Message)
118118
}
119119
return nil, fmt.Errorf("failed to parse TOML: %w", err)

internal/config/config_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ port 3000
11181118
errMsg := err.Error()
11191119
assert.Contains(t, errMsg, "line", "Error should mention line number")
11201120
// Our improved format includes "column" explicitly when ParseError is detected
1121-
assert.True(t, strings.Contains(errMsg, "column") || strings.Contains(errMsg, "line 2"),
1121+
assert.True(t, strings.Contains(errMsg, "column") || strings.Contains(errMsg, "line 2"),
11221122
"Error should mention column or line position, got: %s", errMsg)
11231123
}
11241124

@@ -1200,7 +1200,7 @@ func TestLoadFromFile_StreamingLargeFile(t *testing.T) {
12001200
// Create a TOML file with many servers
12011201
var tomlContent strings.Builder
12021202
tomlContent.WriteString("[gateway]\nport = 3000\n\n")
1203-
1203+
12041204
for i := 1; i <= 100; i++ {
12051205
tomlContent.WriteString(fmt.Sprintf("[servers.server%d]\n", i))
12061206
tomlContent.WriteString("command = \"docker\"\n")
@@ -1239,7 +1239,7 @@ args = ["run", "--rm", "-i", "test/container:latest"]
12391239
cfg, err := LoadFromFile(tmpFile)
12401240
require.Error(t, err, "Expected error for duplicate key")
12411241
assert.Nil(t, cfg, "Config should be nil on error")
1242-
1242+
12431243
// Error should mention the duplicate key
12441244
assert.Contains(t, err.Error(), "line", "Error should mention line number")
12451245
}

0 commit comments

Comments
 (0)