Skip to content

RenderHCLv2Object doesn't handle '\' characters #13

@rayrobdod

Description

@rayrobdod

RenderHCLv2Object doesn't handle \ characters.

In the case of trying to run configure, it will fail to render user.laforge.tmpl and as such the program will be unable to write the results of rendering the template.

This is particularly annoying as, in my case, os.User.Username - the value that this program sets to core.User::ID and is part of the rendered template - includes a \.

Actual Behavior

This is on Windows 10; same results with either cmd or powershell.

%GOPATH%\bin>laforge.exe configure
[LAFORGE:cli]  INFO No config found!
? Enter your name: rrd
? Enter your email address: aaa@example.com
? Write configuration to ~/.laforge/global.laforge? Yes
[LAFORGE:cli] FATAL Terminated due to error: At 3:23: illegal char escape

%GOPATH%\bin>laforge.exe configure
[LAFORGE:cli]  INFO No config found!
? Enter your name: abc\xyz
? Enter your email address: aaa@example.com
? Write configuration to ~/.laforge/global.laforge? Yes
[LAFORGE:cli] FATAL Terminated due to error: At 4:16: illegal char escape

%GOPATH%\bin>laforge.exe configure
[LAFORGE:cli]  INFO No config found!
? Enter your name: abc\nnn
? Enter your email address: aaa@example.com
? Write configuration to ~/.laforge/global.laforge? Yes
[LAFORGE:cli] FATAL Terminated due to error: At 3:23: illegal char escape

%GOPATH%\bin>laforge.exe configure
[LAFORGE:cli]  INFO No config found!
? Enter your name: a\u
? Enter your email address: x
? Write configuration to ~/.laforge/global.laforge? Yes
[LAFORGE:cli] FATAL Terminated due to error: At 4:15: literal not terminated

Expected Behavior

%GOPATH%\bin>TYPE %USERPROFILE%\.laforge\global.laforge
The system cannot find the file specified.

%GOPATH%\bin>laforge.exe configure
[LAFORGE:cli]  INFO No config found!
? Enter your name: a\u
? Enter your email address: x
? Write configuration to ~/.laforge/global.laforge? Yes
[LAFORGE:cli]  INFO Global configuration written to ~/.laforge/global.laforge

%GOPATH%\bin>TYPE %USERPROFILE%\.laforge\global.laforge
// DEFAULT LAFORGE GLOBAL CONFIGURATION

user "Desktop-123456\Raymond" {
  name = "a\u"
  uuid = "12345678-90AB-CDEF-…"
  email = "x"
}

Substitute the \s for \\s if that's necessary for reading the configuration later, but the primary point is that I expect the program to write a configuration with \s represented in the written values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions