Skip to content

bug: raw literal with backslashes becomes "unescaped" #142

Open
@dim0xff

Description

@dim0xff

golines removes "escaped" slashes

// bug.go
package bug

type Struct10 struct {
        Field2   int
        MyStruct any `json:"field"    validate:"\\d+"`
}

Output of golines bug.go:

// bug.go
package bug

type Struct10 struct {
        Field2   int
        MyStruct any `json:"field" validate:"\d+"`
}

Expected output (look at validate tag value):

// bug.go
package bug

type Struct10 struct {
        Field2   int
        MyStruct any `json:"field" validate:"\\d+"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions