Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/playground: allow escaping txtar delimiter #73148

Closed
x1unix opened this issue Apr 3, 2025 · 1 comment
Closed

x/playground: allow escaping txtar delimiter #73148

x1unix opened this issue Apr 3, 2025 · 1 comment
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal.
Milestone

Comments

@x1unix
Copy link

x1unix commented Apr 3, 2025

Description

Let's imagine I want to play with x/tools/txtar package in a Go playground with a snippet like this:

package main

import (
        "fmt"
        "golang.org/x/tools/txtar"
)

// I want to print this string.
const str = `
-- a message --
`

func main() {
	fmt.Print(str)
        ar, err := txtar.Parse([]byte(str))
        if err != nil {
                panic(err)
        }
        
        // ....
}

Contents of a str are detected as a file delimiter as Go Playground uses txtar to bundle multiple files.
This leads to build error.

I thought maybe it's possible to escape -- character to bypass this issue but unfortunately Go Playground doesn't support that:

const str = `
\-- a message --
`

func main() {
	fmt.Print(str) // Prints "\-- a message --"
}

Proposal

Can you please provide some way to escape -- ... -- segments to workaround this issue or provide another better solution to this problem?

Thank you.

@gopherbot gopherbot added this to the Unreleased milestone Apr 3, 2025
@gabyhelp gabyhelp added the FeatureRequest Issues asking for a new feature that does not need a proposal. label Apr 3, 2025
@seankhliao
Copy link
Member

const str = `
`+`-- a message --
`

as an intentionally simple format, I think escape sequenced are out of scope for txtar.

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal.
Projects
None yet
Development

No branches or pull requests

4 participants