bazel-contrib / bazel-contrib/buildtools

Buildifier does not recognize byte string literals

Open
#1,394 1 comment 0 reactions 0 assignees View on GitHub
P2
Dominant language
Go
Stars
1.2k
Forks
471
Avg merge
2d 22h
Merged PRs (30d)
13

Description

```
$ echo 'b"abc"' | buildifier
:1:7: syntax error near "abc"
# reformat
```

Byte-string literals are defined in the [spec](https://github.com/bazelbuild/starlark/blob/master/spec.md#lexical-elements):

> Literals: literals are tokens that denote specific values. Starlark has integer, floating-point, string, and bytes literals.
> ...
> b"hello" b'hello' # bytes

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the error with `echo 'b"abc"' | buildifier` and inspect the Buildifier parsing path for Starlark literals. Confirm the existing handling of ordinary string literals, then make byte-string literals parse and reformat successfully, including both quoted forms shown in the spec.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.