Skip to content

terminal/starlark: fix string output with write_file()#4223

Open
89oso wants to merge 1 commit intogo-delve:masterfrom
89oso:fix/starlark-write-file-output
Open

terminal/starlark: fix string output with write_file()#4223
89oso wants to merge 1 commit intogo-delve:masterfrom
89oso:fix/starlark-write-file-output

Conversation

@89oso
Copy link

@89oso 89oso commented Dec 22, 2025

Fixes #4222

example.star:

def main():
    write_file("test1", "hello\nworld")
    # write_file("test2", 123)  # error

test1:

hello
world

This change fixes the string output when using `write_file()`.

Fixes go-delve#4222
case starlark.Bytes:
data = []byte(v)
default:
err := fmt.Errorf("second argument of write_file must be a string or bytes, got %s", args[1].Type())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default should still be to call String.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected output when using write_file() in starlark script

2 participants